在 git 中创建了一个不需要的分支,想要删除它
Created an unwanted branch in git, want to get rid of it
JIRA 为我正在处理的功能创建了一个分支,但我不想要它。我想将到目前为止所做的所有更改移回 master 分支,并简单地完全删除 feature 分支。谁能帮我?
首先让我们确定这将要做什么:
- 将分支
ANDROIDAPP-137-actions-are-slow
上的提交移动到 master
- 完全删除(本地和远程)
ANDROIDAPP-137-actions-are-slow
分支
先回师父:
git checkout master
现在从您的分支机构获取工作;重新定位到该分支:
git rebase ANDROIDAPP-137-actions-are-slow
现在你的提交应该在 master
和 ANDROIDAPP-137-actions-are-slow
分支上,你可以检查:
git log --all --graph --decorate --oneline
所以你可以删除 jira 分支:
git branch -D ANDROIDAPP-137-actions-are-slow
并远程删除它:
git push origin :ANDROIDAPP-137-actions-are-slow
如果我没看错你的日志,看来你只需要rebase/merge就可以了:
git checkout master
git rebase ANDROIDAPP-137-actions-are-slow
git branch -d ANDROIDAPP-137-actions-are-slow
如果变基不起作用,请改用合并。
有关 git 分支的更多信息 check out the documentation on it.
JIRA 为我正在处理的功能创建了一个分支,但我不想要它。我想将到目前为止所做的所有更改移回 master 分支,并简单地完全删除 feature 分支。谁能帮我?
首先让我们确定这将要做什么:
- 将分支
ANDROIDAPP-137-actions-are-slow
上的提交移动到master
- 完全删除(本地和远程)
ANDROIDAPP-137-actions-are-slow
分支
先回师父:
git checkout master
现在从您的分支机构获取工作;重新定位到该分支:
git rebase ANDROIDAPP-137-actions-are-slow
现在你的提交应该在 master
和 ANDROIDAPP-137-actions-are-slow
分支上,你可以检查:
git log --all --graph --decorate --oneline
所以你可以删除 jira 分支:
git branch -D ANDROIDAPP-137-actions-are-slow
并远程删除它:
git push origin :ANDROIDAPP-137-actions-are-slow
如果我没看错你的日志,看来你只需要rebase/merge就可以了:
git checkout master
git rebase ANDROIDAPP-137-actions-are-slow
git branch -d ANDROIDAPP-137-actions-are-slow
如果变基不起作用,请改用合并。
有关 git 分支的更多信息 check out the documentation on it.