每当我从我们的“主”分支重新定位到我的特性分支时,我的特性分支似乎丢失了它的跟踪信息。这个工作流程有什么问题?
$ git clone repo_url
$ git co -b feature/my_work_task
在这里做一堆工作
$ git commit -am"Commit my work"
$ git push # push the branch upstream
$ git checkout master
$ git pull # get whatever changes that have been put into master
$ git co feature/my_work_task
$ git rebase master # everything seems to be good
在我的功能分支中进行一些额外的更改。
$ git commit -am"more changes to update"
$ git push # pushing this to my remote repo
推送到远程仓库失败并出现以下错误:
To git@github.com:/username/my-repo.git
! [rejected] HEAD -> feature/my_work_task (non-fast-forward)
error: failed to push some refs to 'git@github.com:/username/my-repo.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')
hint: before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
我将按照建议执行“git pull”,然后导致:
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details
git pull <remote> <branch>
If you wish to set tracking information for this branch you can do so with:
git branch --set-upstream feature/my_work_task origin/<branch>
如果我设置上游信息,然后再次尝试“git pull”,我现在将遇到各种文件冲突。
拥有跟上 master 更改的功能分支的最佳方式是什么?