z Git Notes&Workflows - seqcode/pegr GitHub Wiki
To update your branch with the new updated master while you are working on the old version (and you don’t want to re-do your changes after pulling the new one):
-
Make sure you are on your branch.
-
Pull the new changes from master to your branch:
`git pull origin master`
-
To preserve the history (which is useful), do this command too:
`git fetch origin master`
-
-
Resolve the conflicts if you have any.
-
If the pull is successful, then commit your changes to your branch:
`git add [filename or ‘. -u' to add all tracked files]` `git commit`
-
Push your changes to your branch so everything is up-to-date on GitHub
`git push origin [your branch name]`
-
Now your branch is up-to-date and you would like your changes to be merged with the master. In that case, you need to pull a request to allow everyone to review your changes and accept/merge with the master or decline:
- Go to your GitHub page
- Open your branch
- Click on ‘Pull a new Request’
- Then write a title with the imperative present tense
-
Whenever you start working again on your branch, make sure you pull the latest updates from the master to avoid major conflicts, and to keep your branch up to date.
`git checkout [your branch name] && git pull origin master`
Note: There are many ways to do that such as rebase and merge, but this might be the easiest way.
-
Finally, some notes to take into account:
- It is usually better to make small commits (for each sub-feature or change)instead of one that includes all, to make it easier to revert or roll back
- use the imperative present tense in your commit messages or pull request titles.
- Detailed description/documentation of your changes is always appreciated.
- Use GitHub @mention system, if you need a specific reviewer or if you need to draw someone’s attention to a specific issue in your comments/messages.
- Whenever you pick an issue to work on, don’t forget to add yourself as an assignee.
- Don't forget to label your requests/issues with one of the available labels, such as: [enhancement, bug, question...etc.]
- If you are part of the reviewer team or would like to discuss about a pull request, use the comments under that pull request to interact with others.
- You can show your simple approval or agreement with a pull request changes/issue by simply using GitHub emoji
- If you think you are adding a whole new thing that needs to be documented, use the wiki of that project, create a new page, and write your documentation. Don’t forget to add your request/commit IDs.
- Also, if you have new comments that explain your code, you can open your code from compare and add comments to a specific lines of it.
- Please read the first paragraph to link the issue with the your pull request. When merging, the referenced issue will be closed automatically. In order to do that, remember to use one of the keyword in the link in your commit messages. Click Here
Please feel free to add to this page whatever git commands or GitHub features you think we should use in the workflow.