相关疑难解决方法(0)

如何在本地和远程删除Git分支?

我想删除本地和我在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 version-control git-push git-remote git-branch

2万
推荐指数
42
解决办法
784万
查看次数

git:如何使用另一个分支的内容重置分支?

我无法弄清楚如何将一个分支更新为与另一个分支相同。下面是一个例子:

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)

git

5
推荐指数
1
解决办法
2288
查看次数

标签 统计

git ×2

git-branch ×1

git-push ×1

git-remote ×1

version-control ×1