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 commitgit statusgit logSyncing 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.Rgit status to see what is ready to add/commit and check file names.git add mycode.Rgit commit -m "My first commit"git pushgit status to see what is ready to add/commit and check file names.git add mycode.Rgit commit -m "Edits to first bit of code"git pushMost 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>