You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: git/basics.md
+8-4Lines changed: 8 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,9 +19,13 @@
19
19
4. One line : `git log --oneline`
20
20
21
21
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>...`
24
25
25
26
## 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.
0 commit comments