本文的主线 配置 => 仓库 => 提交 => 分支 => 更新 => 合并 => 忽略
配置
1 2 3 4 5
| git config –global user.name "username"
git config –global user.email "email"
|
仓库
1 2 3 4 5
| git clone username@host:/path/to/repository
git init
|
提交
1 2 3 4 5 6 7 8 9 10 11
| git diff
git add *
git commit -m "描述信息"
git push origin master
|
分支
1 2 3 4 5 6 7 8 9 10 11
| git checkout -b feature_x
git push origin feature_x
git branch -d feature_x
git checkout master
|
更新
合并
1 2 3 4 5
| git merge <branch>
git rebase <branch>
|
忽略
1 2 3
| .DS_Store # 忽略macOS下的.DS_Store文件 node_modules/ # 忽略node_modules/目录下的所有文件 *.zip # 忽略所有.zip后缀的文件
|
如果要忽略的文件已经推送至仓库 则上述修改不会生效 还需要做如下操作
1 2 3 4 5
| git rm -r --cached .
git add .
git commit -m 'update .gitignore'
|
参考