Git常用命令

    xiaoxiao2025-08-30  47

    1.查看

    //查看远程所有分支 git branch -a //查看本地所有分支 git branch

    2.删除

    //删除远程分支 git push origin :<branchName> /* or (Git1.7以后) */ git push origin --delete <branchName> //删除本地分支 git branch -d <branchName> git branch -D <branchName>

    3.增加

    //增加本地分支 git checkout -b <branchName> //推送本地分支到远程 git push --set-upstream origin <branchName>

    gitlab和github下fork后如何同步源的新更新 1.首先要先确定一下是否建立了主repo的远程源:

    git remote -v

    2.如果里面只能看到你自己的两个源(fetch 和 push),那就需要添加主repo的源:

    git remote add upstream URL git remote -v

    3.然后你就能看到upstream了。 如果想与主repo合并:

    git fetch upstream git merge upstream/master

    转载请注明原文地址: https://ju.6miu.com/read-1302127.html
    最新回复(0)