Last active
January 14, 2026 10:43
-
-
Save giuliohome/ecef3e6e69736feeb0d6fc7eda7b5d56 to your computer and use it in GitHub Desktop.
Useful git commands
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # sync failed for email privacy... fix git config then | |
| git commit --amend --reset-author --no-edit | |
| # The user wants to restore their version after the merge conflict. | |
| # They want to keep their local changes and discard the remote changes. | |
| git checkout --ours package.json | |
| git checkout --ours package-lock.json | |
| git add package.json package-lock.json | |
| # interrupt a merge, e.g. because you want to switch the order of your commit <--> pull commands | |
| git merge --abort | |
| # undo the last commit | |
| git reset --soft HEAD~ | |
| # check the commit history | |
| git log | |
| # save the password | |
| git config --global credential.helper store | |
| # Your local main branch is orphaned (no commits), but you have many files staged. | |
| # First reset to fork/main, then commit your changes: | |
| git reset --soft fork/main | |
| git commit -m "Your commit message" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment