TIL how to restore deleted branch in git and some comprehenses of `git stash`
Learned how to restore deleted branch in git:
-
Find the SHA1 for the commit at the tip of deleted branch running
git reflog --no-abbrev; -
Recreate branch running
git checkout -b <branch> <sha>.
Learned some comprehenses of git stash:
-
git stash save “Your stash message”allow give message to your stash -
git stash save -uorgit stash save --include-untrackedstashes untracked files -
git stash apply stash@{1}applies specific stash -
git stash popapplies the most recent stash and removes it. Could also be run with specific stashgit stash pop stash@{1} -
git stash showshows summary of stash diffs.git stash show -pshows full diff. Could be run with specific stashgit stash show stash@{1}. -
git stash branch <name> stash@{1}creates a new branch with the latest stash, and then deletes the latest stash (likestash pop). -
git stash clearremoves all sashes in repo. -
git stash dropremoves most top stash without applying it.git stash drop stash@{1}removes specific stash.