GitHub Commits - norrissam/ra-manual GitHub Wiki

Intermediate or local commits are the domain of the programmer involved. The programmer has the liberty to best use these to track progress and inform others who are overseeing any local changes you are making. It may be helpful though to have "atomic commits" on GitHub - that is, a commit should hang together around a single goal or topic. If you have made changes with different purposes since your last commit, it is good practice to add the changes in several logical batches.

For any squash merge messages (i.e. the commits that will be viewed in the future), you should be more formal. Each commit should be made with a message that begins with a reference to the relevant issue(s) and ends with a brief summary of what the commit(s) accomplish(es). We reference issues using the syntax #123 to create a link to issue #123.

A good commit message is concise and descriptive. The message should explain what you did and why you did it. Below are some examples of good and bad commit messages

  • "#123 Modify code.R to add number of observations to main regression table" [Good]
  • "#123 Modifying code.R" [Bad, redundant with what git is recording]

Commits should almost always be made in a branch that corresponds to a GitHub issue rather than in the master branch. Commits are then brought into the master via a pull request.

Keeping branches up to date

Before merging branches back into master, you should always merge master into the branch to make sure that there are no conflicts. This can be done on the command line:

git fetch origin         # gets latest changes made to master
git checkout feature     # switch to your feature branch
git merge master         # merge with master
# resolve any merge conflicts here
git push origin feature  # push branch and update the pull request

Comparing commits

Sometimes it will be necessary to compare versions of code to understand why results have changed. You can do this by tracking down the commits (ie from the commit history in the code tab), and then editing the below url:

https://github.com///compare/<hash 1>..<hash 2>

you fill in the < > fields, where the owner name is probably norrissam, the repo name should be self evident, and the hash's are the 7 character alphanumeric commit identifiers (e.g. a25d90e). You can access these in the commit history or the pull request (the url will look something like https://github.com/norrissam/ref-judge/tree/c4b564a092e27a7c063729bd36adc2e2659926bb, but just take the first seven characters of the hash, ie c4b564a).

⚠️ **GitHub.com Fallback** ⚠️