Git经验手册
从TFS上下载代码到本地,并生成仓库
git tfs clone --except-regex=".Invalid path." --resume http://tfs.gridsum.com:8080/tfs $/AdDissector/trunk
克隆一个仓库副本到本地
git clone http://tfs.gridsum.com:8080/tfs/defaultcollection/_git/AdDissectorGit <optional_dir>
初始化push信息
git config --global push.default matching
存储git密码
git config --global credential.helper store
提交代码的log里面会显示提交者的信息
git config --global user.name
git config --global user.email=
在git命令中开启颜色显示
git config --global color.ui true
列出远程Branch
git branch -r
创建Branch
git branch
提交本地分支到远程
git push origin :
切换Branch
git checkout <branch_name>
获取服务器更新
git pull
添加一个本地更新文件
git add <file_name>
自动添加全部变化文件
git add .
提交变化到本地
git commit -m
上传本地变化到服务器
git push
回退到远程分支
git push origin HEAD --force
git log
git reset --hard
查看远程分支
git branch -a
删除远程分支
git branch -r -d origin/branch-name
git push origin :branch-name
git commit -m "Folder change Related Work Items:#23288"
刷新远程分支:
git remote update --prune
-- prunes tracking branches not on the remote.
git remote prune origin
Tag
git tag 1.0.0
git push origin --tags
git push origin 1.0.0
git checkout 1.0.0
git checkout -b version1 1.0.0
git tag -d 1.0.0
git push origin --delete 1.0.0
合并提交:
git commit --amend --no-edit
if you already have unstaged changes you must run the following after editing your ignore-patterns:
git ls-files -v | sls -pattern ^h -casesensitive
git update-index --assume-unchanged [...]
git update-index --no-assume-unchanged
SubTree:ref
git subtree add --prefix src/xxx/ http://xx/x.git master
git remote add -f ast http://xx/x.git
git fetch ast master
git subtree pull ast --prefix src/xxx/ master
git subtree push ast --prefix src/xxx/ master
git rm -rf src/xxx/
SubModule [Reference]
Merge Request
https://github.com/gitlabhq/gitlabhq/blob/master/doc/api/merge_requests.md#create-mr
http://justcoding.iteye.com/blog/1830388
http://www.ruanyifeng.com/blog/2012/07/git.html
编码问题:http://www.enet.com.cn/article/2013/0805/A20130805300286.shtml