Vault7: CIA Hacking Tools Revealed
Navigation: » Latest version
Owner: User #524297
Git Tips & Tricks
The "I forgot something in my last commit" Trick
# first: stage the changes you want incorporated in the previous commit
# use -C to reuse the previous commit message
$ git commit --amend -C
# or use -m to make a new message
$ git commit --amend -m 'add some stuff and the other stuff i forgot before'
The "Oh no I should have been working in a branch" Trick
# takes staged changes and 'stashes' them for later, and reverts to HEAD.
$ git stash
# creates new branch and switches to it, then takes the stashed changes and stages them in the new branch. fancy!
$ git stash branch new-branch-name