Author: Philip Godfrey
What is Git?
Git is a version control system that allows you to track
changes made to a set of files, making it perfect for collaboration between
teams, and allows you to revert to previous version of the files as needed.
Implementing version control your code is essential so you
can keep track of any changes as you work through your various data science
projects.
Configuring Git on Oracle Data Science Cloud
Service: Branching
A previous blog covered configuring Git and initializing this
within Oracle Data Science, you can read the blog here.
In this blog, we will work through the steps to complete some
basic Git fundamentals, including creating a branch, making and tracking
changes to files.
Create
Branch
It is good
practice to create a branch (copy) of main, so you aren’t working directly in
the main branch.
The objective is that you can work, simultaneously, on different pieces of work, across a Data Science team. Once you’re happy with your branch, or the change you’ve been tasked with, this would be pushed into the main branch. There is an option to select a member of the team who is required to review your change, make any comments before it is confirmed and then pushed into main. A history of changes always persists, so it’s possible to understand main development changes, and revert back, should you need to.
Once created,
you will see that DataScience_Branch is my current working branch, meaning any
changes I make within here will not impact the main branch (until I ask it to).
Changing a
file (within Data Science Notebook)
In the new
branch, we want to start making changes to files that I’m working on. In this
instance, we will change the text in the Readme.md file.
Change file
Check
differences
There is an option to view differences between files, which will show you the original (left hand side) and the changed version (in your branch, on the right hand side)
To access this
click on the icon
We can now see what has been added, highlighted in green. This is a very simple example using some text, but the same process applies for any files you’re working with, such as Python files, SQL files etc.
Join the next
blog to see how we work with these changes, including staging the change.
Comments
Post a Comment