WIP
快速开始
- 设置个人信息
git config --global user.name <YOUR-NAME>
git config --global user.email <YOUR-EMAIL>
# 查看个人配置
git config --list
- 将默认主仓库设置为
mainBLM运动
git config --global init.defaultbranch main
- 初始化仓库
mkdir /path/to/your/project
cd /path/to/your/project
git init # initialize an empty git repo
git remote add origin git@repo-url.git
Create your first file and push it to the remote repo
echo "qtopie.rw" >> contributors.txt
git add contributors.txt
git commit -m 'Initial commit with contributors'
git push -u origin master
总结下常用操作
git init
git add .
git commit -m "first commit"
git remote add origin remote <repo-url>
git branch --set-upstream-to origin/main main
git remote -v
git push
More
- change a commit message:
git commit --amend
Creating Release
Tag
- list Tag
git tag
- create new tag
git tag v0.2
- push new tag
git push origin v0.2
- delete a tag
git tag -d v0.21
Pull Request (PR)
Steps
Fork the original repo
Clone your forked repo and create a feature branch with the head refs from original repo (named
upstream)git fetch upstream # Name of feature branch is BRANCH-FOO git checkout -b upstream/BRANCH-FOOSupposed you have made modifications locally, and added codes and committed the changes, now push it to your forked repo and create a new branch if it does not exist.
git push -u origin BRANCH-FOOThen creating a merge request to original repo, and ask someone to review the codes, either accept or close the merge request.
Note that you can use git stash if you want to switch branches without bringing changes into another branch.
- 代理设置
# socks5
git config --global http.proxy 'socks5://127.0.0.1:1080'
git config --global https.proxy 'socks5://127.0.0.1:1080'
# http
git config --global http.proxy 'http://127.0.0.1:3128'
git config --global https.proxy 'http://127.0.0.1:3128'