假设我有一个名为' abc' 的跟踪分支跟踪origin/master.
当我在' abc'并且做一个时git push,它会abc' 推' ' abc'.
如何使用' git push' 指定远程推送分支?
对不起,如果已经提出这个问题了.
我从一个名为"git_lab"的repo克隆,它有一个名为"test"的分支.克隆时我使用"-b myname_test"创建一个名为"myname_test"的本地分支,本地克隆名为"myname_git_lab"
当我执行"git pull"时,它会自动获取并合并从"test"到"myname_test"的更改,但是对于git push,我需要指定repo和branch名称.
$> git remote show git_lab
为'git pull'配置的本地分支:myname_test与远程测试合并
有没有办法我可以配置"为'git push'配置的本地分支",这样我就不需要指定分支和repo名称?
我在Github上有一个存储库,aav1
在我的笔记本电脑上,我有两个分支,一个名为master,一个名为vs12up .主分支是当软件是Visual Studio 2008时,vs12up转换为Visual Studio 2012.
在我的笔记本电脑上一切似乎都很好,我把新分支推到github,看起来是正确的.
在我的桌面上,我试图拉远程分支:
git pull origin vs12up
Run Code Online (Sandbox Code Playgroud)
它在桌面上将更改写入我的主分支,git log显示在vs12up分支上进行的提交,但git分支仅显示master,这是当前分支.
如何将更改还原到主分支并拉出桌面上的vs12up分支以匹配笔记本电脑上的存储库?
阅读本文之后,将主要分支的更改收集到我的功能分支是有意义的: Git工作流和rebase与合并问题
clone the remote repo
git checkout -b my_new_feature
..work and commit some stuff
git rebase master
..work and commit some stuff
git rebase master
..finish the feature
git checkout master
git merge my_new_feature
Run Code Online (Sandbox Code Playgroud)
如果功能分支对我的机器是本地的,我可以很好地重写历史记录.
但是,如果我在功能分支上与其他人合作,该怎么办?现在我们的功能分支保存在远程存储库中,我们如何从主分支到我们的功能分支获得最新的更改?
那我们合并了吗?或者还有另一种灵巧的GIT方法吗?
提前致谢!
我在服务器上使用一个裸git存储库进行备份,并在本地执行'git commit'后使用'git push'推送本地更改.
'git status'告诉我
# On branch master
# Your branch is ahead of 'origin/master' by X commits.
Run Code Online (Sandbox Code Playgroud)
如果我修改了一个文件,然后执行另一次提交然后执行推送,git告诉我我的分支是由X + 1提交提前的.'git remote show origin'告诉我,fetch和pull URL都与我提供的推送相同.
我已经验证我的更改确实被推送到服务器存储库(通过拉入不同的位置并检查内容).
我在这做错了什么?
PS:我知道SO上有几个相关的问题,但我找不到任何问题的具体问题的答案.如果我在这方面错了,请指出正确的方向.
我做了:
git co upstream/master # To no branch.
<then did a trivial edit on some file...>
git commit -a -m "Trivial edit"
git push origin NewBranch
Run Code Online (Sandbox Code Playgroud)
但得到了这个:
$ git push origin ignore-netbeans-config
error: src refspec ignore-netbeans-config does not match any.
Run Code Online (Sandbox Code Playgroud)
我可以在没有创建本地分支的情况下推送到新分支吗?
我知道如何列出远程分支
$ git branch -a
Run Code Online (Sandbox Code Playgroud)
我知道如何找到当前分支的头部提交哈希值
$ git rev-parse HEAD
Run Code Online (Sandbox Code Playgroud)
但我不确定如何列出所有远程分支的所有头部提交哈希值.这接近我想要的但它们的顺序是什么?
$ git rev-parse --remotes
4b9f7128e9e7fa7d72652ba49c90c37d0727123d
4ebab9616fac6896b7827e8502b4dc7c5aac6b5b
ea7a5fab4a757fb0826253acf1fe7d8c546c178e
...
Run Code Online (Sandbox Code Playgroud)
理想情况下,我想要一个分支名称提交 - 哈希对的列表,甚至是一种传递远程分支名称的方法 git rev-parse HEAD
我有 2 个分支命名developer和Current远程。在本地,我在分支上工作,developer并将更改推送到 remote developer。问题是,如何从本地推developer送到远程Current?
我试过这些:
git push origin Current -f
// error:
// src refspec Current does not match any.
// failed to push some refs to ...
// and this one too:
git config push.default upstream
git push origin Current -f
// error: same as the first try
// and this one too:
git branch --set-upstream-to developer origin/Current
// or:
git branch --set-upstream-to developer Current
// …Run Code Online (Sandbox Code Playgroud) 有一个名为"my-remote"的远程分支,我以前没有问题.截至今天,我无法推动,我得到不同的错误.
我得到的第一个错误是:
Run Code Online (Sandbox Code Playgroud)hint: Updates were rejected because a pushed branch tip is behind its remote hint: counterpart. If you did not intend to push that branch, you may want to hint: specify branches to push or set the 'push.default' configuration hint: variable to 'current' or 'upstream' to push only the current branch.
我做了一些研究,并希望它可以解决问题:
git config push.default tracking
Run Code Online (Sandbox Code Playgroud)
跑完之后我又跑了一下:
git push https://github.com/someurl/mybranch.git
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
pushing to remote 'https://github.com/someurl/mybranch.git', which is not the upstream of
your current branch 'my-remote', without telling me what …Run Code Online (Sandbox Code Playgroud) 情况是这样的:
我从其他远程开发分支创建了远程分支 - >将其获取到本地 - >进行了一些更改 - > git add- > git commit- >推送到远程并进行了拉取请求.
拉请求仍然存在,分支尚未合并.
删除尚未合并的本地分支是否安全?
我不想拥有一堆我不再需要的本地分支机构.
git ×10
remote-branch ×10
git-branch ×4
branch ×3
commit ×2
git-push ×2
git-config ×1
github ×1
merge ×1
push ×1
rebase ×1