Skip to content

Commit ac9acea

Browse files
committed
Add a git tip
1 parent d19220b commit ac9acea

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

content/3.goodies/1.gitcheatsheet.md

+9-1
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,17 @@ I tried to organize git commands by situation where you can need them and I adde
1616
- add them in your current branch
1717
- [Doc](https://git-scm.com/docs/git-cherry-pick)
1818

19+
### When you only want to push some of your commits in your branch
20+
21+
- `git push ebe6952:main` where `ebe6952` is the latest commit you want to push
22+
- push your main branch until the commit `ebe6952`
23+
- it's useful in caseswhen you have `A -> B -> C -> D -> E` on your local repository and you only want to push `C` and `D`
24+
- [Doc](https://git-scm.com/docs/git-push#Documentation/git-push.txt-ltrefspecgt82308203)
25+
26+
1927
### When you messed up your repository with git commands like rebase and want to recover changes from a commit not in your history anymore
2028
- `git reflog`
21-
- gives you an history of the references of your HEAD (current active branch)
29+
- give you an history of the references of your HEAD (current active branch)
2230
- allow you to see on which commit was your HEAD after each git command you did
2331
- once you have the commit hash you are interested in, you can see what changes were made in this commit or even reset the branch to this commit
2432
- [Doc](https://git-scm.com/docs/git-reflog)

0 commit comments

Comments
 (0)