我将从主分支检出一个名为FNB-90
的分支。在FNB-90
分支中,我进行了2次添加、提交并将它们推送到远程仓库。然后,我又从FNB-90
检出另一个名为FNB-90-CHILD
的分支。
a. 如果现在在FNB-90
分支中,我执行以下命令:
$ git fetch # will fetch the latest changes on the remote
$ git reset --hard origin/master # will set your local branch to match the representation of the remote just pulled down.
如果我检出的 FNB-90
分支不符合预期,能否恢复为原始状态?如果不能,那么该怎么做呢?
b. 如果我用命令删除了分支 FNB-90
,
$ git branch -d FNB-90
$ git push origin --delete FNB-90
分支 FNB-90-CHILD
会发生什么,它将成为 master
的直接分支吗?
FNB-90
还原到原始状态。 - Arefebranch -f
)转到应在其中的适当提交位置;更改远程分支可能会影响其他人,但是reflog
通常很方便,可以查看意外移动的地方。 - user2864740