Git

1、创建代码共享库

cd /Users/knightyao/公司/ilaw2
git init --bare

2、Clone远程仓库代码

git clone 地址

3、忽略文件

在和.git同级目录下创建一个.gitignore文件,在该文件中指定需要忽略的文件
cd /Users/knightyao/公司/ilaw2
touch .gitignore
open .gitignore
git status
git add .
git commit -m "添加了需要忽略的内容" 

4、常用命令

git pull origin master //从服务器获取新代码
git add . //添加所有新文件到cached库
git rm -r "文件名" --cached //将不上传的文件从cached库删除
git commit -m "备注" //提交文件到commit库
git push //上传到服务器

git stash //备份当前工作区内容
git stash pop //从Git栈中读取最近一次保存的内容,恢复工作区的相关内容
git stash list //显示Git栈内的所有备份,可以利用这个列表来决定从那个地方恢复。
git stash apply //将Git栈内的备份版本取出
git stash apply stash@{1} //取出编号为stash@{1}的版本

git add.
git commit
git pull origin master
YES
git add.
git commit
git push
NO
git stash
git pull origin master
git stash pop
修改冲突
git add .
git commit
git push

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容