git init
初始化本地git仓库
git pull <url>
拉取远程库
git remote add <name> <url>
关联远程仓库
git add .
添加全部
git commit .
每次修改(包括增/删)都要执行
git rm --cached
不删除物理文件,仅将该文件从缓存中删除
git rm -r
不仅将该文件从缓存中删除,还会将物理文件删除,且不会回收到垃圾桶
git tag v0.1
创建轻量标签
git push yuan v0.1
需显式推送指定标签,或–tags推送所以标签
实例git push ban1(远程库) newone(本地分支):newone(远程分支)
创建并推送远程分支,git push
在此后直接可用
git checkout -b/B <name>
创建本地分支,(-B)名字重复将重置
实例git remote remove yuan
删除远端库
git log --oneline --graph
查看提交历史
外链
问题
On branch master
nothing to commit, working tree clean
检查是否有文件可以提交
To https://github.com/zjw715/PFA2020RM-.git
! [rejected] ben -> ben (fetch first)
error: failed to push some refs to 'https://github.com/zjw715/PFA2020RM-.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
==分支冲突,需要rebase ==