简体   繁体   中英

Rebase git feature branch

I am trying to rebase my feature branch.

I created feature branch name "feature/task1" from 'develop'. After that made changes in feature branch and commit -> push branch to remote and created pull request.(But, work still in progress).

Now, other person made some changes to 'develop' branch. I want that changes to local "feature/task1" branch.

I tried " git pull --rebase " but it shows.

error: cannot pull with rebase: You have unstaged changes.

So, i tried following as i don't want to discard some local changes also don't want to commit.

1.) git stash 2.) git pull --rebase 3.) git stash pop

But, still i can't see those latest changes to my feature branch.

I checked this answer but, not helped much. (If i checkout develop branch i can see latest changes but, not in my feature branch).

When you said you created feature/task1 from develop, you mean local develop? If that's the case, pull won't work, no matter what you do, because you will have to first pull into local develop so that you can pull into your feature branch. You could set the upstream branch to be the remote develop and then it should work

git branch --set-upstream-to=origin/develop #adjust name of remote, if it's not origin
git pull -r

or you could do it manually

git fetch --all
git rebase origin/develop

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