UP | HOME

Using git tags

Table of Contents

Overview

Source version control records a log of changes to the source. In git each change is a called a commit and is given a unique ID. To identify special points in the history, such as version releases, a commit can be tagged with a name, e.g., v1.0.

Use the following tags for each project:

  • project1 for project 1
  • project2 for project 2
  • project3 for project 3
  • project4 for project 4

Applying a tag to your project

Tags get applied to commits, not individual files or directories. So only apply the tag once you have already committed any changes you'd like to submit for the project. You can check to see if you have any uncommitted changes with git status. Commit any changes you'd like included in the graded version of the project and tag it:

git tag project1

Then to sync this tag with the remote copy on GitHub by pushing the tags

git push --tags

On GitHub, you can see your tag on the releases section of your repository to confirm that it is there.

Resubmitting a project

By default, git will not permit you to reuse a tag for another commit. But in order to resubmit your project, you can force git to reassign the tag to another commit with the -f flag:

git tag -f project1

You must also force GitHub to accept the new tag:

git push -f --tags

Author: Paul Gazzillo

Created: 2020-11-04 Wed 20:19