内部使用
|
代码
|
git clone ssh://git@gitlab.yygamedev.com:9022/liuqi/yworld.git yworld
|
|
资源
|
git clone ssh://git@gitlab.yygamedev.com:9022/liuqi/yres.git config
|
|
脚本
|
git clone ssh://git@gitlab.yygamedev.com:9022/liuqi/yscripts.git scripts
|
|
工具
|
git clone git@gitlab.yygamedev.com:9022/liuqi/tools.git tools
|
|
文档
|
git clone git@gitlab.yygamedev.com:9022/liuqi/documents.git tools
|
|
checkout
|
git config --global alias.co checkout
|
|
branch
|
git config --global alias.br branch
|
|
commit
|
git config --global alias.ci commit
|
|
status
|
git config --global alias.st status
|
|
1. 查看当前状态
|
git st
|
|
2. 添加所有修改
|
git add .
慎用,只要st列出的文件都会被添加 |
|
2. 添加所有修改
|
git add -u
对比上面一条,不会添加任何 新增文件, 比较适合本地有 临时文件不需要提交的情况 |
|
3. 提交修改
|
git ci -m "modify desc"
|
|
4. 同步远端
|
git pull
|
|
5. 推送远端
|
git push
|
|
当前分支log
|
git log
|
|
查看指定人员的log
|
git log —-author=username
|
|
查看文件修改追踪
|
git blame file
|
|
查看某条log详细修改内容
|
git show c1c5d692c0
|
|
查看stash内容
|
git show stash@{n}
|
|
同步分支
|
git fetch
|
|
切换分支
|
git co feature/xxx
|
|
查看分支
|
git br [-a]
|
|
删除本地分支
|
git br -d|D feature/xxx
(D表示强制删除) |
|
删除远端分支
|
git push origin --delete feature/xxx
|
|
修改本地分支名称
|
git branch -m devel develop
|
|
以本地当前内容新建分支
|
git co -b feature/xxx
|
|
推送为新分支
|
git push origin feature/xxx
|
|
本地新建分支跟踪远端分支
|
git branch --set-upstream-to origin/feature/xxx
|
|
使用对方版本
|
git co --theirs
|
|
使用自己版本
|
git co --ours
|
|
不能直接使用某方版本
|
手动修改后 git add -f file
|
|
最后提交
|
git ci -m "merge"
|
|
查看暂存列表
|
git stash list
|
|
当前修改暂存
|
git stash save "stash name"
|
|
应用暂存
|
git stash apply stash@{n}
git stash list中会列出n的值 |
|
弹出暂存
|
git stash pop stash@{n}
类似apply,同时会尝试删除stash 若发生冲突则保留改stash |
|
删除暂存
|
git stash drop stash@{n}
|
|
找回删除的内容
|
git fsck --lost-found
|
|
清理远端已删除的分支
|
git fetch -p
|
|
回滚本地提交
|
git reset --hard commit_id
|
|
回滚本地后,强制推送远端
|
git push -f
|
No comments yet.
Cheatography n. The art of mapping complex subjects into clear, instantly navigable reference guides.