I realize there are similar answers, such as the one found here , but these expect that you know the structure of GitHub commits and branches, and I don't.
So my question is if I want to pull a commit 12fds123nfd1123sefs12
from branch master
on GitHub, what is the git fetch
command?
For clarity, I mean I want to pull all commits up to a given commit.
You have at least two ways to achieve that: the first one is to remove all the commits that are after the desired commit. Interactive rebase will help you:
$ git rebase 12fds123nfd1123sefs12 -i
You will see a text editor, you have to remove everything in it, then save it and forcely update the remote branch:
$ git push origin master -f
The second way is to create a branch based on the desired commit and then release this branch:
$ git checkout -b fixedmaster 12fds123nfd1123sefs12
Now you have the fixedmaster
branch that doesn't have any bad commits. You can release it.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.