您的位置:首页 > 其它

关于git的学习笔记

2014-12-11 10:55 190 查看
例如,我修改了文件 test.txt

git add test.txt

git commit test.txt

如果是git add test.txt

1.可以用git reset HEAD test.txt 将暂存区的修改撤销掉,重新放回工作区。

2.然后再用 git checkout -- test.txt 丢弃工作区的修改。

记得可以用git status 查看当前git下的状态。

Git鼓励大量使用分支:

查看分支:
git branch


创建分支:
git branch <name>


切换分支:
git checkout <name>


创建+切换分支:
git checkout -b <name>


合并某分支到当前分支:
git merge <name>


删除分支:
git branch -d <name>


果然有省略的命令写法:

git config --global alias.st status


就可以用 git st 了~~~

还有一种设置方式:

git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"


可以让你的git界面五颜六色
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  开源 git