git常用操作

 

1)git 分支改名
首先,确保你已经检出到要重命名的分支上。
git checkout old-branch-name

然后,使用git branch -m命令来重命名当前分支。
git branch -m new-branch-name

如果你想重命名其他分支,你可以使用以下命令:
git branch -m old-branch-name new-branch-name

2) 查询当前分支名称
git rev-parse --abbrev-ref HEAD

3)修改git commit的默认编辑器
git config --global core.editor "vim"

4)查看某次提交涉及的文件增、删、改
git show --name-status <commit-hash>

5)查看某个分支的提交记录
git log -1 <branch-name>

6) 修改最近一次提交信息
git commit --amend -m "xxx"
git push --force-with-lease

7) 查看当前分支的所有操作记录,包括amend等
git reflog <branch-name>

 

ubuntu git commit打开默认是nano

 

posted @ 2024-10-31 11:06  LiuYanYGZ  阅读(12)  评论(0)    收藏  举报