Skip to content

Git hook that checks for stashes when you check out a branch.

License

Notifications You must be signed in to change notification settings

imnotashrimp/stashed-on-branch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 

Repository files navigation

stashed-on-branch git hook

This is a simple post-checkout git hook that checks for stashes that may be on the current branch.

Git hooks aren't committed to the repo, so you'll need to install this hook in every repo where you want it, and on every collaborator's machine.

Installation

Automated installation is simplest, but if you already have a post-checkout git hook, you'll need to install the hook manually.

Automated installation

You'll need curl installed to run this command.

cd into your repo's root folder:

cd /path/to/your/repo/

Then run this command:

bash <(curl -s https://raw.githubusercontent.com/imnotashrimp/stashed-on-branch/master/install.sh)

Manual installation

  1. Copy the post-checkout script to your repo at .git/hooks/post-checkout.
  2. Make the script executable by running chmod +x /your/repo/path/.git/hooks/post-checkout.

Try it out

  1. After installation, create a temporary branch:

    git checkout -b DELETEME
  2. Change a file, and then stash the changes:

    git stash
  3. Switch to a different branch:

    git checkout master
  4. And then switch back to the temporary branch:

    git checkout DELETEME

    If you see a list of stashes from the branch, everything's good. If not, double-check that the hook was installed in the repo at .git/hooks/post-checkout.

  5. When you're done, switch to another branch and delete the test branch:

    git checkout master
    git branch -d DELETEME

About

Git hook that checks for stashes when you check out a branch.

Resources

License

Stars

Watchers

Forks

Languages