@zhongjianxin
2019-10-11T11:40:40.000000Z
字数 1204
阅读 681
AFS-HW-Java
Practice:
1. 在github上创建一个repo(gittest).
2. 创建一个本地仓库,并将本地仓库推向远端repo. (
git init
touch readme.md
git add .
git commit -m "initiate the project"
git add remote origin [url]]
git push -u origin
or
git push --set-upstream origin master
commit 1 in browser
commit 2 in cli
git pull
git push
commit 2 in browser
git fetch
git merge
conflict handle
commit 3 update text in browser
commit 3 update the same text in cli
git fetch
git merge ------>conflict
handle conflict
git push
再git clone一个repo
git branch -b newbranchname
git fetch
在命令行查看本地和远程的所有branch
# 列出所有本地分支
$ git branch
# 列出所有远程分支
$ git branch -r
# 列出所有本地分支和远程分支
$ git branch -a
# 新建一个分支,但依然停留在当前分支
$ git branch [branch-name]
# 新建一个分支,并切换到该分支
$ git checkout -b [branch]
git log --pretty=oneline
git pull 相当于 git fetch + git merge
类似地,git pull --rebase 相当于 git fetch + git rebase
fetch 只是获取 HEAD 指针,而不会更新代码
https://blog.csdn.net/weixin_41975655/article/details/82887273
git rebase
https://www.jianshu.com/p/dc367c8dca8e