Unfuddle STACK Tips & Tricks
How do I pull a specific commit?
The short answer is: you cannot pull a specific commit from a remote.
However, you may fetch new data from the remote and then use
git-checkout COMMIT_ID to view the code at the
If you want to bring that specific
COMMIT_ID to your local branch, you may either use
git-cherry-pick to bring only that commit over, or
git-merge to bring all changes up to that commit to your local branch.
# make sure you fetch from the origin first $ git fetch origin # view code at COMMIT_ID (abc123) $ git checkout abc123 # bring only COMMIT_ID (abc123) # to your branch # assuming your branch is master $ git checkout master $ git cherry-pick abc123 # bring all changes up to # COMMIT_ID (abc123) to your branch # assuming your branch is master $ git checkout master $ git merge abc123
You can find more information in the Official Documentation.