A repository that contains life and timer saver git commands; rollback, revert, etc. (in-progress)
- How to delete all local git branches?
- How to undo the last commit from a remote git repository?
- How to revert merge?
- How to revert conflicted merge?
- How to checkout/update a single file from remote origin master?
- How to pick a commit and apply current branch from another branch? (cherry-pick)
- How to Git cherry-pick only changes to certain files?
- How to remove untracked files?
- How to add a message to stash?
- How to bring nth record from the stash list without removing it?
- How to bring last entry to the stash list and remove?
- How to delete a stash record from the list?
- How to move latest changes to stash with different branch?
- How to visualize all git logs?
git branch --list | grep -v 'master' | xargs git branch -D
git reset HEAD^
git push origin +HEAD
# create new branch for being safe.
git revert -m 1 <MERGE_COMMIT_ID>
git push
git merge --abort
git checkout origin/<branch-name> -- <path-to-file>
git cherry-pick <commit_id>
# cherry-pick -n (--no-commit) which lets you inspect (and modify) the result before committing.
git cherry-pick -n <commit>
# unstage everything
git reset HEAD
# stage the modifications you do want
git add <path>
# make the work tree match the index
# (do this from the top level of the repo)
git checkout .
git ls-files --others --exclude-standard | xargs rm
git stash save "Your stash message"
git stash apply {n} # n is optional, from nth history.
git stash pop
git stash drop
git stash branch <new-branch-name>
git log --oneline --graph --decorate --all