Git - CLI笔录
Git的CLI笔录
origin: 表示远程仓库节点名称。 当有多个远程仓库时 可新增远程仓库节点名称如 new_origin | new_remote
origin/HEAD: 表示当前Git仓库默认分支的引用,通常指向origin/master或origin/main
git symbolic-ref refs/remotes/origin/HEAD
--------------------------------------------------------------
git branch
git branch <branch>
git branch -r
git branch -a
git branch -M main
git branch -d <branch>
git checkout <branch>
git branch -u new_origin/<branch>
git remote -v
git remote update
git remote add origin <URL>
git remote remove <URL>
--------------------------------------------------------------
git pull = git fetch + git merge
git fetch origin
git fetch <URL> <branch>
git merge origin/<branch>
git pull <branch>
git pull origin <remote_branch>:<local_branch>
git push origin <branch>
git push origin <remote_branch>:<local_branch>
git push -f origin <remote_branch>:<local_branch>
git push origin -d <branch>
--------------------------------------------------------------
git clone <URL>
git add .
git commit -m 'desc'
--------------------------------------------------------------
git reflog
git reset --hard xxx
git push -f origin master:master
--------------------------------------------------------------
--------------------------------------------------------------
--------------------------------------------------------------
echo '# project description' >> README.md
git init
git add .
git commit -m 'commit v1.0.0 open source code.'
git branch -M main
git remote add origin <URL>
git push -u origin main