Basic github workflow

Reference: 

https://code.tutsplus.com/tutorials/how-to-collaborate-on-github--net-34267

https://guides.github.com/introduction/flow/

This workflow is separated as two fields. First is how to establish a local repository and the second is how to connect the local repo to online counterpart. 

 

1 Local Repository

Create files, including Readme.md, .gitignore, scripts and all other files. Do not forget to modify the .gitignore file to exclude the files that you do not want to upload. 

Then press key "shift" while right click your mouse, and choose "open the powershell in this directory"

 

 Then in the command line input in sequence: "git init", "git add .", "git commit -m 'your_commit_name'". The command git status not necessary but is used here to recheck whether files are collected.

 

 

 

2 Adding the upstream remote

cd into the local repository

git remote add upstream git@... (or html copied when cloning the repository)

Then, when running command "git remote", your outcome should like

$ git remote
origin
upstream

This now allow you to pull in changes from the source locally and merge them, like:

git fetch upstream
git merge upstream/master

 

· Check out a branch, commit and push

Before making your own changes, checkout a new branch. Now commit and push to this new branch

git checkout -b a_new_branch
(...  make your changes )
git commit -am "added welcome"
git push origin a_new_branch

 When you create a branch, you are creating an environment where you can try out new ideas. Anything in master must be deployable, yet in branches you can try out freely and test your idea. Besides, your branch name should be specific (e.g. make-reina-avatars)

 

· Create a Pull Request

A pull request is like saying to the owner "Hello, I bettered the program and hopefully you can accept these changes"

You can choose the "New pull request" besides the "Branch: master"(or whatever other branches) tag and choose the branch you wanna merge. 

 Then in this page, choose your branch and fill in the blank of your modification. Then let's create a pull request. Note that you can check the difference in the bootom of the web page. 

 

· Merge pull request

After code review and discussion, in the "Pull Requests" panel, you can merge the pull requests. 

 

posted @ 2020-06-05 14:31  hey,dummy  阅读(217)  评论(0编辑  收藏  举报