From 5121fece91a8198d5bae72b5d0041945b0b16767 Mon Sep 17 00:00:00 2001 From: rahul Date: Sun, 28 Aug 2016 08:13:08 +0530 Subject: [PATCH 1/3] Add git stash cheat --- cheat/cheatsheets/git | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/cheat/cheatsheets/git b/cheat/cheatsheets/git index 2a814b0..01657fc 100644 --- a/cheat/cheatsheets/git +++ b/cheat/cheatsheets/git @@ -11,6 +11,24 @@ git config --global color.ui true # To stage all changes for commit: git add --all +# To stash changes locally, this will keep the changes in a separate changelist +# called stash and the working directory is cleaned. You can apply changes +# from the stash anytime +git stash + +# To stash changes with a message +git stash save "message" + +# To list all the stashed changes +git stash list + +# To apply the most recent change and remove the stash from the stash list +git stash pop + +# To apply any stash from the list of stashes. This does not remove the stash +# from the stash list +git stash apply stash@{6} + # To commit staged changes git commit -m "Your commit message" From 80d2a09456e7786e178a389da4b3520105158812 Mon Sep 17 00:00:00 2001 From: rahul Date: Sun, 28 Aug 2016 08:19:20 +0530 Subject: [PATCH 2/3] Add revert in git cheat --- cheat/cheatsheets/git | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cheat/cheatsheets/git b/cheat/cheatsheets/git index 01657fc..5b809cb 100644 --- a/cheat/cheatsheets/git +++ b/cheat/cheatsheets/git @@ -142,3 +142,6 @@ git show :/cool # Undo parts of last commit in a specific file git checkout -p HEAD^ -- /path/to/file + +# Revert a commit and keep the history of the reverted change as a separate revert commit +git revert From 6a1742984c1ed47b1c5d0293a1fb8fa2c63150e5 Mon Sep 17 00:00:00 2001 From: rahul Date: Sun, 28 Aug 2016 08:24:02 +0530 Subject: [PATCH 3/3] Add cheery-pick to git cheat --- cheat/cheatsheets/git | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cheat/cheatsheets/git b/cheat/cheatsheets/git index 5b809cb..56a8ab7 100644 --- a/cheat/cheatsheets/git +++ b/cheat/cheatsheets/git @@ -145,3 +145,7 @@ git checkout -p HEAD^ -- /path/to/file # Revert a commit and keep the history of the reverted change as a separate revert commit git revert + +# Pich a commit from a branch to current branch. This is different than merge as +# this just applies a single commit from a branch to current branch +git cherry-pick