Git别名使用例子
gst ( git status ) 查看当前状态
➜ test git:(master) ✗ gst
On branch master
Your branch is up-to-date with 'origin/master'.
Untracked files:
(use "git add <file>..." to include in what will be committed)
foot.html
index.html
nothing added to commit but untracked files present (use "git add" to track)
gaa ( git add . ) 添加所有文件
➜ test git:(master) ✗ gaa
➜ test git:(master) ✗ gcam 'new file'
[master 1632f1b] new file
2 files changed, 2 insertions(+)
create mode 100644 foot.html
create mode 100644 index.html
ggpush ( git push origin $branch_name ) 提交
➜ test git:(master) ggpush
Username for 'https://github.com': zhuowenji
Password for 'https://[email protected]':
Counting objects: 4, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (4/4), 335 bytes | 0 bytes/s, done.
Total 4 (delta 0), reused 0 (delta 0)
To https:
60aa7e6..1632f1b master -> master
gp ( git push origin $branch_name ) 提交
➜ test git:(zhuo_test) gp origin zhuo_test
Username for 'https://github.com': zhuowenji
Password for 'https://[email protected]':
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 269 bytes | 0 bytes/s, done.
Total 3 (delta 1), reused 0 (delta 0)
To https:
* [new branch] zhuo_test -> zhuo_test
gcb ( git commit -b ) 新建分支并切换到新分支
➜ test git:(master) gcb zhuo_test
Switched to a new branch 'zhuo_test'
gco ( git checkout $branch_name ) 切换分支
➜ test git:(master) gco zhuo_test
Switched to branch 'zhuo_test'
➜ test git:(zhuo_test) gcm
Switched to branch 'master'
gb ( git branch ) 查看本地分支
➜ test git:(zhuo_test) gb
master
* zhuo_test
gba ( git branch -a )查看本地和远程分支
➜ test git:(zhuo_test) gba
master
* zhuo_test
remotes/origin/HEAD -> origin/master
remotes/origin/master
remotes/origin/wenji
gm ( git merge $zhuo_test ) 合并分支
➜ test git:(master) gm zhuo_test
Merge made by the 'recursive' strategy.
zhuo.html | 1 +
1 file changed, 1 insertion(+)
create mode 100644 zhuo.html
gmom ( git merge master ) 合并主干分支
➜ test git:(zhuo_test) gmom
Updating 8f4318f..4c41d70
Fast-forward
merge.html | 1 +
1 file changed, 1 insertion(+)
create mode 100644 merge.html
glg ( git log -n ) 查看最新n条日志
➜ test git:(master) glg -10