我从我的导师Xing Fan指导和帮助,利用我的导师chunlong Li提供ChatGPT,在百度搜索,学习一些资料。以下很多内容都是我的导师Xing Fan做的。谢谢Xing Fan。考虑到隐私,不适合截图公开。
第一步:
打开Git Bash Here
如果空白文件夹的话,git init。
第二步:
远程仓库建立联系。
git clone <git repo url>
如果已经有了本地仓库,可以省略远程仓库建立联系。
第三步:
切换分支如下:
git checkout <your git branch name>
自己取的本地分支名
我学到了git checkout -b xxxxx,在本地上可以随意换分支名。
切换branch直接用git checkout <branch_name>就可以,加上-b是创建一个branch
创建新的分支如下:
git checkout -b <new-branch>
查看远程所有分支git branch -r。
第四步:
git add <文件名>
git commit -m "名字"
以下的内容,我没试过。
git stash
git pulll origin <远程分支名>
git stash pop
第五步:
确定需要拉的分支名
在Github的网页上确认一下
git fetch origin <远程分支>
拉取他人分支
git pull origin <git branch name you want to sync with>.
第六步:
调试,修改之后 ,git add <paths of files you want to commit>
第七步:
git commit -m "<commit info you want to attached to your commit>"
第八步:
git merge <远程分支名>
第九步:
git push(第一次需要设置远程branch,terminal里会有提示:git push --set-upstream origin <branch name>)
git push -u origin 分支名