git初始化远程仓库
在初始化远程仓库最好使用下面命令来初始化:
而不要使用:
如果使用了git init初始化,则远程仓库的目录下,也包含work tree,当本地仓库向远程仓库push时
如果远程仓库正在push的分支上(如果当时不在push的分支,就没有问题)
那么push后的结果不会反应在work tree上
也即在远程仓库的目录下
对应的文件还是之前的内容,必须得使用git reset --hard才能看到push后的内容
以下是git提示的警告信息
warning: Updating the currently checked out branch may cause confusion,
warning: as the index and work tree do not reflect changes that are in HEAD.
warning: As a result, you may see the changes you just pushed into it
warning: reverted when you run 'git diff' over there, and you may want
warning: to run 'git reset --hard' before starting to work to recover.
warning: as the index and work tree do not reflect changes that are in HEAD.
warning: As a result, you may see the changes you just pushed into it
warning: reverted when you run 'git diff' over there, and you may want
warning: to run 'git reset --hard' before starting to work to recover.
我们可以配置远程git的
它可以设置成refuse,warn,ignore选项来拒绝、警告或忽略