Copia Automation delivers modern developer tools for industrial automation. Our Git-based source control solution for PLCs streamlines workflows for faster delivery and maximized uptime.
After committing, but before pushing, a set of changes to your repository, you can amend the most recent commit. This allows you to change the commit message, description, and file contents in your commit before re-committing, and pushing those changes to the remote repository.
This allows you to actually change the contents of a commit, rather than committing new changes on top of old ones, however can only be performed on the most recent commit, and only if the commit only exists in the local repository; as such, Amending a commit is most helpful when you notice a mistake in your PLC logic, or a typo in your commit message – or, for example, leaving out the Jira issue key if you’re using Copia’s Jira integration – before pushing those changes to your remote repository.
Copia always allows you to revert the most recent commit to your repository, even if the commit has been pushed to the remote repository. Reverting creates a new commit, undoing the changes in the most recent commit; this ensures that the reverted commit remains unchanged in the commit history, and indicates in the new commit that the prior commit had been reverted.
Like Amending, Reverting can only be performed on the most recent commit with Copia, however a commit can still be reverted if it is already on the remote repository. This is most helpful when you notice an issue in the most recent commit you or any teammate has made which must be undone, and allows you to record publicly that this has been done.
A Commit Checkout allows you to recover the contents of any previous commit; when you check out a commit, your repository is temporarily set back to the state it was in when that commit was made, in what’s known as a ‘Detached Head’ state. This is a temporary branch at the selected commit, meaning, you will only see the commit history leading up to the selected commit, and you will be unable to push any commits you make in this state. Importantly, this also means that any commits you make to your repository while in this state will be erased when you move back onto a named branch. However, you can create a permanent branch from a ‘Detached Head’ state, which will allow you to return to this version simply by switching branches, and will allow you to commit changes normally to your newly created branch. In your repository history, the new branch will branch off from your selected commit, making it easy to see which version was used to create the new branch.
Unlike Amend and Revert, a Checkout can be performed on any commit from any branch, giving much more power to retrieve prior versions of your PLC files; however, it requires that a new branch be created to make any new commits to the retrieved version. As such, it is most useful when making new changes to legacy code, or temporarily retrieving an older version of your repository to recommission a downed machine.
Restoring from a Commit functions like a Commit Checkout, with a few key differences. Restoring sets the contents of your repository to the state they were in when the restored commit was made; however, it does not place you in a ‘Detached Head’ state, instead keeping you in whichever branch you were already in. Instead, it shows the old version as ‘new’ changes, and allows you to freely modify and commit these changes onto your current branch.
Restoring from a Commit is most helpful when undoing several recent commits onto your main code branch, or, generally, when you want to restore any prior version of your repository’s contents as the most recent commit.
For commits made mistakenly, users may wish to undo a commit completely, rather than amend the commit. Copia provides the option to undo commits made, which haven't yet been pushed to the remote repository. Undoing a commit doesn't change the files currently in your repository, but caution should be taken, as undoing a commit removes it from the repository completely, after which it can't be checked out or restored.