git 使用中发现的问题记录
1. 当新建了多个分支,如果分支中没有任何内容,则使用git branch
语句时不会有相应的显示。
2. 查看所有的分支(包括远程分支):
git branch -a
删除远程分支:
git push origin --delete <branchName>
3. 指定本地dev分支与远程origin/dev分支的链接方法
git branch --set-upstream-to dev origin/dev
4. 如何查看本地跟踪分支对应的远程分支
git branch -vv
5. 遇到提示:please enter a commit message to explain why this merge is necessary,especially if it merges an updated upstream into a topic branch.解决方法如下:
press “i”
write your merge message
press “esc”
write “:wq”
then press enter
6. 当删除远程分支使用下列语句
git push origin --delete master
出现以下错误提示
To git@github.com:xxx/xxx.git
! [remote rejected] IO (refusing to delete the current branch: refs/heads/master)
error: failed to push some refs to 'git@github.com:xxx/xxx.git'
原因是删除了该repo默认的分支,因此如果必须要删除该分支,需要在Github中把默认分支default branch修改成其他的分支。(该解决方案来自stackoverflow)