简体   繁体   中英

How do I get commits from origin into my local branch?

I have a fork ("origin") of a project on github ("upstream"). I have a branch ( mybranch ), which I pushed to origin and created a pull request from.

Now, someone pushed to my branch on my fork. This means, mybranch on origin is ahead of my local mybranch by x commits.

How do I get those commits into my local branch, as single commits.

I've seen solutions of deleting my local branch and using git reset --hard origin/master , but that just doesn't feel right. Is there a more natural solution?

someone pushed to my branch on my fork. This means, mybranch on origin is ahead of my local mybranch by x commits.

Then a simple git pull --rebase is enough: it will update your local branch with the remote ones, and replay any local commits (done on your local branch but not yet pushed) on top of those new commits.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM