Github 常用命令
这里主要是记录一下常用的github命令,便于查询。
Pull/Push/Fetch commands explanation
Create a branch and push back to github:
git checkout -b dev
git push origin HEAD -u
Git Command to push from dev branch to master
git checkout master
git pull # to update the state to the latest remote master state
git merge develop # to bring changes to local master from your develop branch
git push origin master # push current HEAD to remote master branch
Steps to create a pull request for code review
-
Clone Git Repository
Git clone <git url>
-
Create your local branch
Git checkout -b JesseDev
-
Update your code and you can use git status to check updated files
-
Commit changes to your develop branch
- Check your branch by:
git branch --all
- Commit to your develop branch:
Git commit
- Check your branch by:
-
push the current branch and set the remote as upstream
Git push --set-upstream origin JesseDev
-
Create a pull request for code review
--------Common commands for branches -----------
check branch: git branch
create branch: git branch
swtich branch: git checkout
create+swtich branch: git checkout -b
merge to current branch: git merge
associate remote branch: git pull origin
delete branch: git branch -d
delete remote branch: git push origin --delete
*For PR related, this is a great one, refer to: https://www.cnblogs.com/momo798/p/11599679.html