Last active
October 15, 2019 16:50
-
-
Save MMachado-uy/f33fe3023b133712a0003ea1192f7589 to your computer and use it in GitHub Desktop.
Go to a branch, do stuff and git back to where you were
This file contains 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
#!/bin/bash | |
# Add this file with run permissions in a PATH-visible folder | |
# Run it from a repository with `git back` to go back to the previous branch | |
prev=$(git describe --all $(git rev-parse @{-1}) | sed 's/heads\///g') | |
git checkout $prev |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment