git命令备忘

36 阅读1分钟

1. 从远程拉新分支到本地:

- 获取远程仓库最新信息:git fetch origin
- 基于远程创建一个分支到本地:git checkout -b new_branch_name origin/new_branch_name

2. 给分支添加备注

- git config branch.分支名.description 备注信息

3. 回退到某次commit

- git log 
        比如:commit aaa (tag:xxx)
             Author: www <xxx@leadbank.com.cn>
             Date:   Wed Oct 30 16:59:55 2024 +0800
- 回退到aaa次提交:git reset --hard aaa
- 推到远程 :  git push origin 分支名 --force