Version Control - Git

Users can create a new Git repository in Aqua Data Studio and manage files or checkout remote Git projects hosted in Google Code Project HostingGithubGitoriousHeroku, etc. Users can also interact with the Git Command Line Options using the Open API interface AQGit under com.aquafold.openapi.vcs in the AquaScript editor.

The Git Client offers a convenient UI for all of Aqua Data Studio's Git administrative and management capabilities, including some that are not possible through right-click context menus in the Files Browser such as creating, applying, and deleting Stashes. To launch the Git client, right-click on an existing mount in the Files Browser that contains a Git Repository.

Your first GIT Repository using Aqua Data Studio

With Aqua Data Studio, you can create a GIT repository and be up and running in 1 easy step

Set up a GIT repository (bare)

  1. Select the Files Tab. Context click on Filesystem
  2. Select Create Git Repository
  3. Browse to your local directory structure.
  4. Check Mount Git Repository Directory to have it automatically mounted in the Files browser. If you do not check this you must manually mount the directory.
  5. An empty GIT repository will be created in the chosen folder and it will appear in the Files browser with Version Control Status indicators

Right-click
Create Git Repository
Select a directory

To mount and use a directory that is already part of a Git repository

Step 1: Mount the Directory in the Aqua Data Studio Filesystem Tree View
  1. Select the Files Tab. Context click on Filesystem
  2. Select Mount Directory
  3. Choose the folder that has already been associated with a Git repository

Mount a Directory
Step 2: Configure the Directory with GIT Version Control
  1. Right Click the Mounted Directory in Step 1
  2. Select Version Control > Git > Configure
  3. Click OK and Version Control indicators appear

Right-click Mounted
Directory Configure
Repository Details
Displayed
Version Control
Green Indicators

This will successfully configure your GIT repository with Aqua Data Studio. To test if you have successfully created the GIT repository using ADS, right-click on the directory and select the option Explore. If you see a hidden folder .git, then you have are now ready to check in your files and commit. Every git repository is stored in the .git folder of the directory in which you create the git repository. directory. This directory contains in the .git/config the local configuration for the repository and the complete history of the repo.

Add files and Commit

  1. Create new text or SQL files or copy the files you require to be in version control to the Git Repository created using Aqua Data Studio
  2. Multi-select the files, right-click and select Version Control > Add. If you see a '+' sign before the files, these are added to version control
  3. To Commit the files, right-click on the directory and select Commit.

Multiselect New Files
Version Control Add
Multiselect and
Commit
Version Control
Commit Dialog
Version Control
Commit Success

Once all the files are committed, you see a green tick mark to indicate that the files are now versioned.

Clone a remote Git Repository 

Let us now try to clone a repository from a remote server - Twitter Bootstrap is Twitter's toolkit for kickstarting CSS for websites and apps. It is hosted in Github and the URI is https://github.com/renatolouro/Simplate.git

  1. Select the Files Tab. Context click on Filesystem
  2. Select Version Control > Git > Clone Repository
  3. Enter General tab, select Git and enter the Repository URI - https://github.com/renatolouro/Simplate.git
  4. Select a destination folder in your local system. Browse and select the checkout directory
  5. Click OK and Aqua Data Studio displays the status of the received files. 

Git Remote
Checkout
Git Remote Checkout
Success

Once all the files are received and references are updated to 100%, you will notice the cloned GIT Repository in your Filesystem tree view. Expand the directory and you can find the latest committed files.

Pull changes from a cloned remote Git Repository 

Suppose the authors of the Twitter Bootstrap make changes to their source, how will you update your local git repository?

  1. Under Filesystem, select the cloned directory. Right-click and select Pull
  2. Once all the files are updated, the "up-to-date" message displays

Git Pull from
Remote Repository

Push your changes to remote Git Repository in GitHub, google projects, heroku, gitorious, etc.

Now that you have used Aqua Data Studio to interact with your local Git repository and made changes to files, added new files, and committed, you want to make sure that the remote repository is also updated. Please note that committing using Aqua Data Studio only updates your local copy. You need to "Push" the changes to the remote git account.

  1. Under Filesystem, select the directory that you want changes to be updated. Right-click and select Version Control > Push
  2. Select Source Branch
  3. Select the Destination Repository from the drop-down.
  4. If you want to update another location, which is not configured with your local GIT repository, select Arbitrary Location and specify the URI. For e.g. https://github.com/yourproject/git_repo_name.git. Note that you need the authentication to Push to the location or you are a member of the project
  5. You can include options to Force overwrite existing branch, use thin pack, and include tags

Git Push to
Remote Repository
Git Pushed to
Remote Host

Once all the files are updated, you can log in to your git account and see the changes under "Commits". Verify the Commit History which displays the Author, Date, and the Revision number and you have now successfully Pushed your changes to a Remote GIT repository.

Add a Remote Server

If you want to push to several repositories hosted on a remote server, add those servers in Aqua Data Studio using the below steps.

  1. Under Filesystem, select your git repository. Right-click and select Version Control > Add Remote
  2. Enter a name 
  3. Enter the URI
  4. Click Add

Git Add Remote Host

Now next time you try to "Push" this remote server will be available under the Destination Repository in the dropdown. See step 2 in Push your changes to remote Git Repository in Github, google projects, heroku, gitorious, etc

Create, Delete Branches, Switch, and Checkout

A single Git repository can contain any number of branches. To create a new branch using Aqua Data Studio follow the below steps

  1. Under Filesystem, select your git repository. Right-click and select Branch...
  2. Now to create a branch, enter a new branch name
  3. Choose from the dropdown where it should start from
  4. Click OK 

Git Create Branch

A new branch is created and you are now switched to the new branch

To switch to a different branch, follow the steps below:
  1. Under Filesystem, select your git repository. Right-click and select Version Control > Switch/Checkout
  2. The Branch Name field will be populated with your current branch
  3. Select the dropdown and the list of available branches will be displayed
  4. Choose the branch you want to change to
  5. Click OK 

Git Switch Branch

You are now switched to the selected branch.

Delete a Branch

  1. Under Filesystem, select your git repository. Right-click and select Version Control > Delete Branch
  2. The Branch Name field will be populated with your current branch
  3. Select the dropdown and the list of available branches will be displayed
  4. Choose the branch you want to delete
  5. Click OK 

Git Delete Branch

Merge changes from a selected commit to your current branch using Aqua Data Studio

Suppose you created a new development branch named Experiment from the original branch Master. Using the Merge feature in Aqua Data Studio, you can now merge changes made on your current branch since it diverged from master until its current commit on top of master.

  1. Under Filesystem, select your git repository. Right-click and select Version Control > Merge
  2. The list of available Branches and Tags displays
  3. Select the branch you want to merge. Master in this case.
  4. Click OK 

Git Merge

A merge result "Merged" will notify you of the operation

Resolve conflict after a Git Pull using Aqua Data Studio

Suppose you have committed a local file and the same file exists in the remote server which is also edited and committed. Now if you do a git pull, you will get a conflict. This is the Error: Cannot pull into a repository with state: MERGING

  1. Open the local file which is in the conflicting state.
  2. Use ADS editor to manually edit and make the changes to reflect the remote file. This step resolves the conflicting contents
  3. When you are done, git add the affected files using ADS GUI
  4. Commit to complete the merge

Create a Tag using Aqua Data Studio

  1. Under Filesystem, select your git repository. Right-click and select Version Control > Tag
  2. If you are going to create a tag at the Head version, select the radio button Head, enter a message and click OK
  3. If you are going to create a tag for a particular revision, select the radio button revision, Click History and navigate to the commit
  4. Choose the commit that you want to Tag
  5. Click OK and now you have successfully tagged a revision

Git Tag

See in the attached picture how I have tagged a commit to version v1.0.0

Cherry Picking using Aqua Data Studio - Apply one commit from one branch to another

  1. In the Files Browser, select your git repository. Right-click and select Git Client
  2. In the upper left dropdown, navigate through the list of Tags and Branches
  3. Once you have found the branch that contains the commit, select the commit you want to cherry-pick. Right-click and select Cherry Pick This Commit
  4. Close the dialog and you can see that you have successfully cherry-picked and committed the new change to your branch

Git Cherrypick

Rebase

It is possible to perform a Rebase operation by right-clicking on a mount associated with Git and selecting Version Control > Rebase...

Once you select the Rebase context menu, a dialog will appear allowing you to perform your Rebase with options for selecting specific

  • Branch
  • Tag
  • Revision

Git Rebase MenuGit Rebase Dialog

Show History - a graphical tool similar to gitk

Within the scripts pane, left-click on a file, files, or directory to select, then right-click and navigate to Version Control to select Show History... This will display the Version Control history of the selection in the repository. Within the Repository Browser, expanding the tree to select the file or directory you wish to view the history on, then left-clicking it brings up its history in the History Table. The history displayed in the Repository Browser and the history displayed when selecting Version Control > Show History work similarly.

  1. The upper left pane shows the series of commits to this repository, with the most recent on top
  2. There is a local branch, named "master", it points to the most recent commit
  3. If you scroll towards the bottom of the list, you can see that there are several commits so far
  4. You can view the comments for each commit under the header description 
  5. Select a commit and right-click. Now select Show Changes and you can see the list of files impacted for this particular commit.
  6. The commit SHA (unique identifier, similar to subversion revision number) of the second commit is displayed
  7. The lower panel shows the commit details, including the full Diff with splines to show line differences.

Git HistoryGit History
Show Changes 

Git Client (Formerly the Git Repository Browser)

The Git Repository Browser from previous versions of Aqua Data Studio has been replaced with the Git Client. All of the Repository Browser's features have been included, plus many additional features. The Git Client is a convenient way to view and act on all of the contents of a repository. 

To launch it, right-click on an item that is part of a Git mount in the Files Browser and select Git Client.

 Additional Git features
  • Compare with Base Revision
  • Reset
  • Clean
  • Track Remote Branch
  • Remove Remote
  • An option to disconnect from the Git server.
  • Properties - displays Repository URI, Username, and Email Address
  • Inline differences - You can use Text editors for SQL, HTML, XML, text, JavaScript, and Java support syntax highlighting and inline differences. Color-coded indicators instantly mark changes that differ from the local working copy
  • File Search  - You can search for files in specified folders by name and file contents, and even across a subset of files found by a previous search


  • No labels