Last active
January 16, 2023 06:20
-
-
Save BoxResin/f05fcb3c98b6e145b54f21ce0169a2fb to your computer and use it in GitHub Desktop.
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
// Move the branch pointer to a different commit | |
git branch -f branch-name commit-name | |
// Cancel merging | |
git reset --hard ORIG_HEAD | |
git reset --merge ORIG_HEAD ;; If you wanna keep your changes | |
// Cancel editing a file | |
git checkout -- <file> | |
// Make a file unstaged | |
git reset HEAD <file> | |
// Rebase without changing the date | |
git rebase --ignore-date | |
// Stash only non-staged files | |
git stash --keep-index | |
// Create a patch file | |
git diff --no-prefix > output.patch | |
// Create a patch file from the current commit | |
git format-patch --no-prefix -1 @ --stdout > output.patch | |
// Apply the patch file | |
patch -p0 < output.patch |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment