Materials originally developed for the "Version control for research" breakout session of the Best Practice for Code Archiving workshop, 11 December 2016.
We’ve introduced the following basic git workflow using git on the command line:
Local operations
git add <file>
git commit
git status
git log
Syncing with a remote
git push
To clarify the above, when using git for a project we follow these steps:
git init
), or
clone an existing remote repository from GitHub
(git clone
).mycode.R
git status
to see what is ready to add/commit and check file names.git add mycode.R
git commit -m "My first commit"
git push
git status
to see what is ready to add/commit and check file names.git add mycode.R
git commit -m "Edits to first bit of code"
git push
Most of the time you’ll just be using four git commands: add
, commit
, push
and status
Git and GitHub are extremely powerful and flexible systems and there is a lot more you can learn if you wish. Here are some starting points:
git help <command>