Introduction to Git and GitHub

Session - Undo last merge

Zoë Turner

The benefit of working in increments

Working in small chunks, committing and using pull requests means that there are more points to revert back to if things go wrong

In GitHub, find the pull request and at the bottom is a button Revert and this doesn’t disappear over time

Revert button

Screenshot of a day old GitHub Pull Request with the Revert button highlighted

History of mistakes

  • Using Revert in GitHub (and other ways to undo work) creates a new commit
  • This means that your commit history is a record of all your work, even mistakes
  • It’s absolutely ok and not something to be anxious about (when it’s code)
  • But if you do commit information that is sensitive this needs to be removed this needs to be treated as an incident or breach

Removing sensitive data from a repository

It’s a thing that every user of GitHub needs to consider and GitHub has guidance but does refer to a tool that needs installing

If this isn’t available to you it is still possible to purge a file and its commit history but as there are many different scenarios… TiddlyWiki.

is like a choose your own adventure.

When in doubt - make it private

You can change the visibility of a repository through the Settings tab in GitHub

It’s possible to move a public repository to private and back again any number of times

End session

Acknowledgements

CDU Data Science Team blog When things go wrong in GitHub