我创建了一个远程分支,我现在要删除它,因为它被合并回我们的集成分支.我做了
git push origin :name_of_branch
Run Code Online (Sandbox Code Playgroud)
删除远程分支.
但是,不幸的是我错了,其他开发人员实际上有一个本地提交源自该分支.我怎么打扰他的工作,当他拉扯时他的变化现在处于危险之中?
谢谢
我无法弄清楚如何删除远程分支.
我试图模仿以下GIT命令:git push origin:branchToDelete
以下代码及其与空源的变化:
RefSpec refSpec = new RefSpec();
refSpec = refSpec.setSource("");
// remove branch from origin:
git.push().setRefSpecs(refSpec).add(branchToDelete).call();
Run Code Online (Sandbox Code Playgroud)
投掷和例外如:
org.eclipse.jgit.api.errors.JGitInternalException: Exception caught during execution of push command
at org.eclipse.jgit.api.PushCommand.call(PushCommand.java:175)
at org.gitscripts.DeleteBranchOperation.execute(DeleteBranchOperation.java:27)
at org.gitscripts.Main.main(Main.java:27)
Caused by: java.io.IOException: Source ref doesnt resolve to any object.
at org.eclipse.jgit.transport.RemoteRefUpdate.<init>(RemoteRefUpdate.java:285)
at org.eclipse.jgit.transport.RemoteRefUpdate.<init>(RemoteRefUpdate.java:189)
at org.eclipse.jgit.transport.Transport.findRemoteRefUpdatesFor(Transport.java:612)
at org.eclipse.jgit.transport.Transport.findRemoteRefUpdatesFor(Transport.java:1150)
at org.eclipse.jgit.api.PushCommand.call(PushCommand.java:149)
... 2 more
Run Code Online (Sandbox Code Playgroud)
提前感谢您的想法和解决方案.
当我执行命令时:
git branch -r,它只是显示:
origin/HEAD -> origin/master
origin/development-elton
origin/master
Run Code Online (Sandbox Code Playgroud)
当执行命令时:
git remote show origin,它显示:
remote origin
Fetch URL: git@bitbucket.org:r2a_/grconsig.git
Push URL: git@bitbucket.org:r2a_/grconsig.git
HEAD branch: master
Remote branches:
caio-dev new (next fetch will store in remotes/origin)
controle-usuario new (next fetch will store in remotes/origin)
development-elton tracked
master tracked
rails-admin new (next fetch will store in remotes/origin)
**refinancy new (next fetch will store in remotes/origin)**
Run Code Online (Sandbox Code Playgroud)
如何为我的本地提取分支再融资?
我在本地创建了一个存储库并将所有更改推送到 github。后来我创建了一个名为“v2”的新分支(“git branch v2”)并做了一些修改并将该分支也推送到了github。后来当我执行命令“git remote show origin”时,我得到以下输出。
* remote origin
Fetch URL: https://github.com/mayuran19/se24_P03.git
Push URL: https://github.com/mayuran19/se24_P03.git
HEAD branch: master
Remote branches:
master tracked
v2 tracked
Local branch configured for 'git pull':
master merges with remote master
Local refs configured for 'git push':
master pushes to master (local out of date)
v2 pushes to v2 (local out of date)
Run Code Online (Sandbox Code Playgroud)
但是当我执行命令“git branch -vv”时,它显示分支“v2”不是跟踪分支。
master bad4ed9 [origin/master] Correct name
* v2 6ec46b0 Data files
Run Code Online (Sandbox Code Playgroud)
我的问题是,为什么即使远程分支在 github 中可用并且我能够执行此分支的拉取和推送,为什么分支 v2 没有显示为跟踪分支?
命令“git branch -a”的输出显示以下输出
master …Run Code Online (Sandbox Code Playgroud) git version-control github remote-branch branching-and-merging
我在bitbucket上有一个包含三个分支的存储库.我能够使用一个好的旧git branch --remote命令列出远程分支,一切都很完美.但是,当我使用浏览器访问我的存储库时,我只能看到两个分支.有人请帮忙.Bitbucket只吃了我的分店
我在github.com上的远程代码中做了一些更改.现在,我需要将我的本地主分支与原点进行比较.我使用下面的命令来获取差异,但我没有在终端上看到差异.
git diff master origin/master
Run Code Online (Sandbox Code Playgroud)
如果我使用下面的命令,我可以从原点拉出最新的,我可以看到我的更改.
git pull origin master
Run Code Online (Sandbox Code Playgroud)
如何在不使用的情况下看到master和origin/master中的diff git pull?
该git branch -a命令为我提供以下输出:
master
stable
remotes/origin/master
remotes/origin/restoring_entered_information_from_post
remotes/origin/stable
Run Code Online (Sandbox Code Playgroud)
但是restoring_entered_information_from_post在Github上没有这样的分支,我从来没有在本地创建它,并试图用git push origin :restoring_entered_information_from_post它来删除它响应:
error: unable to push to unqualified destination: restoring_entered_information_from_post
The destination refspec neither matches an existing ref on the remote nor
begins with refs/, and we are unable to guess a prefix based on the source ref.
error: failed to push some refs to 'git@github.com:MyCompany/mywebsite.git'
Run Code Online (Sandbox Code Playgroud)