RCS — Revision Control System
CVS — Concurrent Versions System
SVN — Subversion
Getting started with version control workflows
Unity Cluster
Research Computing
Why should we care about using git?
General
Code evolves over time
Identify when bugs were introduced
Easily work with others
Research
Essential for reproducibility
Save time for you and collaborators
RCS — Revision Control System
CVS — Concurrent Versions System
SVN — Subversion
Git
Mercurial
Darcs
Need to choose something
Git has become de facto version control software
Most popular version control software
In this section, we will do the following:
Tell git your name and email.
Global:
$ git config --global user.name "John Doe"
$ git config --global user.email "john.doe@example.com"Local (per-project):
$ git config user.name "John Doe"
$ git config user.email "john.doe@example.com"Set your default text editor:
$ git config --global core.editor "<your editor here>"List the current settings:
$ git config --listCreate a new git repository
$ mkdir example-repository
$ cd example-repository
$ git init
hint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint:
hint: git config --global init.defaultBranch <name>
hint:
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint:
hint: git branch -m <name>
Initialized empty Git repository in /home/solj/git/example-repository/.git/$ touch foo
$ git status
On branch master
No commits yet
Untracked files:
(use "git add <file>..." to include in what will be committed)
foo
nothing added to commit but untracked files present (use "git add" to track)$ git add foo
$ git status
On branch master
No commits yet
Changes to be committed:
(use "git rm --cached <file>..." to unstage)
new file: foo$ git commit -m "Initial commit" -sv
[master (root-commit) 7723f4f] Initial commit
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 fooWhy is a commit message important?
What is a good commit message?
Learn more about commit messages[1]
Atomic Commits
Short and Unambiguous
Active Voice
Add defer_batch to handle large job influxAdded feature ...Subject line (try to keep under 50 characters)
Multi-line description of commit,
feel free to be detailed.
[Ticket: X]Other example commit structures:

$ touch bar
$ echo "foobar" >> foo
$ git add foo
$ git add bar
$ git restore --staged bar
Learn about the stash
The git stash command provides a way to save your changes (temporarily) and get a clean working directory.
The stash is most useful when multitasking.
Not ready (yet) to commit your changes
Need to switch branches to work on a bugfix but don’t want to lose your work
$ git stash # or git stash push
Saved working directory and index state WIP on master: 7723f4f Initial commit
$ git stash list
stash@{0}: WIP on master: 7723f4f Initial commit
$ git stash show
foo | 1 +
1 file changed, 1 insertion(+)
$ git stash show -p
diff --git a/foo b/foo
index e69de29..323fae0 100644
--- a/foo
+++ b/foo
@@ -0,0 +1 @@
+foobar$ git stash pop
On branch master
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: foo
Untracked files:
(use "git add <file>..." to include in what will be committed)
bar
no changes added to commit (use "git add" and/or "git commit -a")
Dropped refs/stash@{0} (3da3bc9570fe3ec91bf73837fd8e03cc4476479f)
$ git add bar foo
$ git commit -m "Add foo and bar" -asv
$ git mv bar baz
$ git commit -m "Move bar to baz" -sv
$ git commit --amend -m "Rename bar to baz" -sv
$ git rm baz
$ git commit -m "Remove baz" -sv
$ git revert HEAD
Keep in touch! To contact us:
Join the Unity User Community on Slack
Submit a ticket to hpc@umass.edu
Attend our Zoom Office Hours, Tuesdays 2:30 pm to 4 pm
| Get this talk at https://bit.ly/unity-git-basics |