美文网首页
git 常用命令

git 常用命令

作者: 美旭_2e39 | 来源:发表于2021-04-14 16:14 被阅读0次

    git 拉取远程分支到本地

    git checkout -b x origin/x        拉取远程分支并同时创建对应的本地分支

    git推送本地分支到远程

    git checkout -b x     创建本地分支

    git push origin x 推送

    git在错误的分支修改代码

    git stash -> 切换正确分支 -> git stash pop (未add)

    git log ->  复制id  -> git reset id --soft ->重复上一条(已add或commit)

    git错误push

    git log -> 复制id  -> git reset id --hard -> git push -f  (错误代码及错误代码后提交的内容全部消失)

    git log -> 复制id  -> git reset id --soft  ->  git stash  -> git push -f -> git stash pop -> 修改错误代码 ->git push (只修改不丢失)

    You have not concluded your merge(MERGE_HEADexists).Please,commityour changesbeforeyou canmerge.

    git merge --abort

    git reset --merge

    相关文章

      网友评论

          本文标题:git 常用命令

          本文链接:https://www.haomeiwen.com/subject/twxllltx.html