我有三个分支,main branch
,development branch
和new_feature
分支。
问题是我意外地在development branch
上设置了我的第一次提交(初始提交)。
答案 0 :(得分:0)
您可以使用主分支merge
开发分支,或使用主分支中的cherry-pick
命令检索初始提交。
答案 1 :(得分:0)
git push -u origin development//(push it up to development)
git checkout main //checkout local main branch
git pull origin development //Pull latest from remote development branch into main
git add -A
git commit -m "get latest from development"
git push -u origin //push up to main
答案 2 :(得分:0)
您可以重命名开发分支。
$ git checkout development # checkout development
$ git checkout -b development-backup # backup development branch
$ git branch -D master # delete your current local master
$ git branch -m development master # rename development -> master
$ git checkout master # checkout master
$ git push -f origin master # force push, update remote master
答案 3 :(得分:0)
由于您尚未将远程分支(origin / development和origin / new_feature)合并到本地仓库中。所以有两种情况
不需要远程更改。请按照以下步骤操作:
MoreExecutors.directExecutor()
,git checkout master
,然后是git checkout --orphan master1
git commit
和git checkout development
(如果有冲突文件,您可以使用git rebase master1
和git add filename
)。git rebase --continue
和git branch -D master
git branch -D new_feature
,git branch -m master1 master
和git checkout master
git branch new_feature
需要远程更改。请按照以下步骤操作:
git push -f --all
,git checkout development
,git merge origin/development
,git checkout new_feature
git merge origin/new_feature
,git checkout master
,然后是git checkout --orphan master1
git commit
和git checkout developmen
git rebase master1
和git checkout new_feature
git rebase master1
和git branch -D master
git branch -m master1 master