Git学习笔记1

Git管理资源有三个资源库,一个是远程仓库、一个是本地仓库、一个本地文件。

本地文件提交步骤:先用 git commit -m "备注"  提交到本地仓库,然后再用git push origin master 提交到远程仓库。

本地文件更新步骤:先用 git fetch upstream pool 获取远程更新到本地文件,然后再用 git merge upstream/pool 进行合并。合并之前可能会要求进行提交,那么就执行git commit -m "备注" 命令先进行提交,再执行merge操作。

1、命令

git remote add upstream git@github.com:JTUS/Funkytown.git        #添加remote代码库为JTUS代码库,并命名为upstream
git fetch upstream +refs/heads/pool:refs/remotes/origin/pool         #获取upstream更新
git fetch upstream pool                                                     #获取upstream更新
git checkout -b pool upstream/pool                                               #创建并切换分支
git checkout pool                                                        #切换分支
git merge upstream/pool                                                        #合并
git push origin pool                                                       #提交
 
2、git pull 是git fetch 和git merge 的组合
原文地址:https://www.cnblogs.com/sunflower627/p/4537893.html