Git 手册
Hz 2019-08-05 Monday Git
Git 日常操作技巧及总结
1. 保存Http模式的Git认证信息
# 先输入以下命令
git config --global credential.helper store
# 拉取一下最新代码
git pull
# 输入用户名密码
# 后续操作无需再输入密码了
#解决文件名过长错误
git config --global core.longpaths true
1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
参考:
- How to save username and password in GIT? (opens new window)
- Caching your GitHub password in Git (opens new window)
- Git解决Filename too long的问题 (opens new window)
2. Fork后更新源代码
git remote add upstream https://github.com/xxxxxx
git remote -v
git fetch upstream
# 切换到上游分支
git checkout -b upstream_master upstream/master
git checkout tag_1.0 #(will create a headless branch)
git branch -D tagbranch #(make sure this branch doesn't already exist locally)
git checkout -b tagbranch
git merge -s ours mybranch
git commit -am "updated mybranch with tag_1.0"
git checkout mybranch
git merge tagbranch
1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12