Last active
August 29, 2015 14:03
-
-
Save blasten/396fa02b0442c21bfec8 to your computer and use it in GitHub Desktop.
GIT useful commands
This file contains 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
# Download the lastest from remote without trying to merge | |
# or rebase and reset the master branch to what was fetched | |
git fetch --all && git reset --hard origin/master | |
# Show files in the index that are unmerged | |
git ls-files -u | |
# Clone a branch | |
git clone -b Branch-name Repo-Url | |
# A better git log | |
# https://coderwall.com/p/euwpig/a-better-git-log | |
git lg | |
# Checkout a version | |
git checkout --theirs file | |
git checkout --ours file | |
# This is most often done when you remembered what you just committed is incomplete | |
git reset --soft HEAD~1 | |
# Commit the changes, reusing the old commit message. | |
# "reset" copied the old head to .git/ORIG_HEAD; | |
# commit with '-c ORIG_HEAD' starts with the log message from the old commit and allows you to edit it. | |
# If you do not need to edit the message further, you can give -C option instead. | |
git commit -c ORIG_HEAD | |
# Edit last git message | |
git commit --amend |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment