简体   繁体   English

重新设置git功能分支

[英]Rebase git feature branch

I am trying to rebase my feature branch. 我正在尝试重新建立功能分支。

I created feature branch name "feature/task1" from 'develop'. 我从“ develop”创建了功能分支名称“ feature / task1”。 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. 我希望将其更改为本地“功能/任务1”分支。

I tried " git pull --rebase " but it shows. 我尝试了“ git pull --rebase ”,但它显示了。

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 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? 当您说您是从development创建功能/任务1时,您是说本地开发? 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. 如果是这种情况,无论您做什么,pull都不会起作用,因为您必须先拉入本地开发,才能拉入功能分支。 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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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