我想删除本地和我在GitHub上的远程项目分支上的分支.
$ git branch -d remotes/origin/bugfix
error: branch 'remotes/origin/bugfix' not found.
$ git branch -d origin/bugfix
error: branch 'origin/bugfix' not found.
$ git branch -rd origin/bugfix
Deleted remote branch origin/bugfix (was 2a14ef7).
$ git push
Everything up-to-date
$ git pull
From github.com:gituser/gitproject
* [new branch] bugfix -> origin/bugfix
Already up-to-date.
Run Code Online (Sandbox Code Playgroud)
remotes/origin/bugfix
在本地和GitHub上成功删除分支我需要做些什么
?
我无法弄清楚如何将一个分支更新为与另一个分支相同。下面是一个例子:
git init test; cd test
echo apple >a; echo banana >b; git add a b; git commit -m 'A1/a:apple;b:banana'
echo carrot >c; git add c; git commit -m 'A2/c:carrot'
git checkout -b second HEAD^1
echo beets >b; echo dandelion >d; git add b d; git commit -m 'B1/b:beets;d:dandelion'
Run Code Online (Sandbox Code Playgroud)
在这一点上,我的历史看起来像这样:
A1-----A2 (master, contains a:apple, b:banana, c:carrot)
\
\----B1 (second, contains a:apple, b:beets, d:dandelion)
Run Code Online (Sandbox Code Playgroud)
现在我想向“第二个”分支添加一个提交,使其内容与“主”分支匹配,即:
A1-----A2
\
\----B1--?--B2 (desired contents a:apple, b:banana, c:carrot)
Run Code Online (Sandbox Code Playgroud)
我的问题是,我运行哪些 git 命令来执行此操作?我想出的最接近的是:
git checkout master .
git …
Run Code Online (Sandbox Code Playgroud)