git config user.name
git config user.email
git config --global user.name "leida"
git config --global user.email "leida@bjfu.edu.cn"
echo "###" >> README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https:....
git push -u origin master
- git clone之后会自动建立remote
- 同一行文本被不同分支修改过,才会有冲突,只有一个人修改,则不存在冲突,会直接覆盖
git push -u origin dev
- 表示将当前分支推送到远程dev分支上,-u表示建立关联,之后就只需要git push 就行
- 出现refuseing to merge unrelated histories,按如下解决
git pull origin master --allow-unrelated-histories
git push --set-upstream origin hexo
git init
git add .
git commit -m "first commit"
git remote add origin https:....
git pull origin master --allow-unrelated-histories
# pull过程中合并两个分支,之后解决冲突
# 注意清理缓存重新提交,不然ignore可能会失效
git rm -r --cache .
git add .
git commit -m "first commit"
git push
git rm -r --cached xxx //xxx表示不再想版本控制的文件,然后在 .gitignore 文件中加入该忽略的文件
git add .
git commit -m 'update .gitignore'