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

  1. Clone Git Repository
    Git clone <git url>

  2. Create your local branch
    Git checkout -b JesseDev

  3. Update your code and you can use git status to check updated files

  4. Commit changes to your develop branch

    • Check your branch by: git branch --all
    • Commit to your develop branch: Git commit
  5. push the current branch and set the remote as upstream
    Git push --set-upstream origin JesseDev

  6. 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

posted @ 2020-11-18 08:43  AED-Jesse  阅读(87)  评论(0编辑  收藏  举报