git小技巧(6)——“git branch -m

git branch -m <oldname> <newname>可以把branch重命名。例如:

[root@localhost test_git]# git branch
  master
* new
[root@localhost test_git]# git branch -m new new1
[root@localhost test_git]# git branch
  master
* new1

如果要重命名的就是当前branch,可以省略<oldname>

[root@localhost test_git]# git branch -m new2
[root@localhost test_git]# git branch
  master
* new2

git小技巧(1)——“git log –oneline”

git log --oneline可以让一个commit只用一行输出,这样显得特别紧凑。例如:

[[email protected] git_repo]# git log --oneline
5f08b5f Add navigation links
7f9fa70 Create blue and orange pages
7807520 Commit the first version of index.html.

也可加上文件名:仅输出某个文件的log

[root@localhost git_repo]# git log --oneline blue.html
5f08b5f Add navigation links
7f9fa70 Create blue and orange pages