查看本地分支和远程分支
git branch -vv
git remote show origin
cat .git/config
git branch -a
本地分支与远程分支进行关联
分两种情况:
- 本地创建了分支dev,而远程没有
- git push -u origin dev 或
- git push —set-upstream-to=origin/dev dev
- 远程创建了分支dev,而本地没有
- git pull origin dev // 先将远程分支dev pull到本地
- git checkout -b dev origin/dev
把上面的命令合在一起,可以写成下面格式
git pull origin dev:dev
查看本地分支对应的远程分支
git branch -va
git branch -vv
Git global settings
git config --global user.name "hnscdg"
git config --global user.email "hnscdg@126.com"
Create git repository
mkdir data-screen
cd data-screen
git init
touch README.md
git add README.md
git commit -m "first commit"
git remote add origin https://gitee.com/hnscdg/data-screen.git
git push -u origin master
Existing repository
cd existing_git_repo
git remote add origin https://gitee.com/hnscdg/data-screen.git
git push -u origin master