回退某个文件的版本 filetxt建立跟踪分支删除本地分支删除远程分支比较两个分支的不同推送本地分支非跟踪分支到远程已有分支
origin 为远程仓库名, branch 在 origin/branch 中指该远程仓库中分支名, 其他地方表git命令选项
回退某个文件的版本 file.txt
git
log file.txt
记下需回退的版本号 commit_id
git rest commit_id
file.txt
git commit -m
'commit message'
建立跟踪分支
1. 需要自定义本地仓库名称:(
name为本地仓库的名称, origin/branch为远程仓库名/分支名)
git checkout -b <
name> origin/branch
2. 通远程仓库名相同
git checkout
删除本地分支
git branch
-d branch_name
如果本地分支没有合并到主分支,需要使用
-D 选项, 即
git branch
-D branch_name
删除远程分支
git
push --
delete origin/branch
git
push origin --
delete branch
git
push origin :branch
比较两个分支的不同
git
log branch1_name --
not branch2_name
推送本地分支(非跟踪分支)到远程已有分支
git push origin local_branch:remote_branch
转载请注明原文地址: https://ju.6miu.com/read-1307381.html