来个常用Git代码共享命令记录
git init
初始化本地git仓库
git pull
拉取远程库
git remote add
关联远程仓库
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
创建本地分支,(-B)名字重复将重置
实例git remote remove yuan
删除远端库
git log --oneline --graph
查看提交历史
外链
rebase相关
问题
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 ==
本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!
