更新**不**当前分支(在Git中) [英] Update **not** the current branch (in Git)

查看:216
本文介绍了更新**不**当前分支(在Git中)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我在分支功能中。我想分支给分支 master

  git rebase master 

它表示功能分支已启动-至今。当然,这是因为 master 分支没有改变 - 它与我创建特性分支时的时刻相同从它。



其实它不是。我只需要在 master 分支中执行操作。

  git checkout master 
git pull
git checkout feature

我的问题:can not I更新 master 没有检出的分支?

我试过特性分支:

  git pull原点大师master 

...但它更新了特性分支(不是我想要的),它提交了 in fururein。



非常感谢任何建议! :)

解决方案

  git push。原点/主:master 

圆点指向当前存储库。这会阻止你进行非快进更新。如果你仍然想这样做,你可以添加 -f --force 选项。


So I am in branch feature. And I want to rebase w/ branch master.

git rebase master

And it says that feature branch is up-to-date. Of course it is because master branch hasn't changed — it is the same as in moment when I create feature branch from it.

Actually it is not. All I need is to do pull in master branch.

git checkout master
git pull
git checkout feature

My question: can't I update master branch w/o checking-out to it?

I tried from feature branch:

git pull origin master master

...but it updated feature branch (not what I wanted to) and it has commits "in furure" in it.

Thanks in any advice! :)

解决方案

git push . origin/master:master

the dot refers to the current repository. This will stop you from doing non-fast-forward updates. If you still want to that, you can add the -f or --force options.

这篇关于更新**不**当前分支(在Git中)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆