Created
April 4, 2017 14:03
-
-
Save leonascimento/2a74411e2f9ebb5597be8d5163fb0000 to your computer and use it in GitHub Desktop.
git-toggle
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git reflog | grep 'checkout' | head -n 1 | awk '{print "git checkout " $6}' | sh - |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How to use?
You should create a folder for example
gitscripts
Create in your .zshrc
PATH=$PATH:/home/your-user/Documents/gitscripts
Create a file into gitscripts folder called git-toggle
~/Documents/gitscripts/git-toggle
Give permission
Go to folder with git repository initialized.
git checkout the fist_branch
git checkout other_branch
So, now I don't remember in what branch I stayed, and now.