caroundsky / QA

0 stars 0 forks source link

Git 操作 #4

Open caroundsky opened 1 year ago

caroundsky commented 1 year ago

Clone 指定分支并重命名

git clone -b 分支名 xxx.git 自定义文件名

删除指定分支或远程分支

合并特定的提交记录

git cherry-pick commit-id

版本回退

git reset --hard HEAD~1 git push origin master --force

错误信息 git fatal: refusing to merge unrelated histories

后面跟上参数--allow-unrelated-histories

本地取消远程分支并关联新分支

git remote remove origin git remote add origin xxx.git

合并多次提交为一次提交

commit之后,撤销commit

git reset --soft HEAD^

错误信息 Auto packing the repository in background for optimum performance. See "git help gc" for manual housekeeping

git fsck git gc --prune=now

拉取代码没有权限 git@gitlab.banggood.cn's password: Permission denied, please try again.

输入密码无效的话,需要重新生成凭据 ssh-keygen -t rsa -C "你的邮箱"