Skip to content

Commit 1c1bece

Browse files
update git commands
1 parent 342fdde commit 1c1bece

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

git/basics.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,13 @@
1919
4. One line : `git log --oneline`
2020

2121

22-
## Discarding local changes
23-
1. Discard all local commits to a branch to make the branch identical with remote - ```git reset --hard @{u}```
22+
## Discarding changes
23+
1. Discard all local commits to a branch to make the branch identical with remote - `git reset --hard @{u}`
24+
2. Revert specific commits i.e. add a new commit that reverts a commmit - `git revert <commit>...`
2425

2526
## Git Merge/Rebase
26-
1. Git rebase master onto a branch (assuming the branch is checked out ) - ```git rebase master```
27-
2. Pushing changes to remote branch after rebase. Since rebase changes the branch history, can't simply push changes to it. So need to force a push ```git push -f```. Don't do it if it's a shared branch.
27+
1. Git rebase master onto a branch (assuming the branch is checked out ) - `git rebase master`
28+
2. Pushing changes to remote branch after rebase. Since rebase changes the branch history, can't simply push changes to it. So need to force a push `git push -f`. Don't do it if it's a shared branch.
29+
30+
## Git References
31+
1. `HEAD^n` refers to nth commit before HEAD

0 commit comments

Comments
 (0)