On the homepage in the left side navigation, click the link labeled Version control. The URL could look something like this: http://localhost:6789/version-control.

Demo

Setup

Set Git directory

The Git directory is the local folder that will be linked to your remote repository.

Authentication

You will be able to authenticate with GitHub by default, but if you need to authenticate with GitHub Enterprise (GHE) or other providers, you will need to follow the steps below. You can authenticate with multiple git providers if you need to. Mage will attempt to use the oauth provider based on the URL of the remote.

Mage authenticates with a default GitHub OAuth application that may not be able to access your repository depending on the repository or organization settings. If you encounter issues accessing your repository after authenticating with GitHub, you may need to create your own OAuth application that has access to the repositories you want to work with. You can follow the steps in the Authenticate with GitHub or GHE section below to connect Mage with your OAuth application.

When creating the OAuth app for GHE, BitBucket, GitLab, you will need to set the authorized callback URL to http(s)://<your-mage-url>/oauth.

Click the Authenticate button next to your Git Provider to start the authentication process.

After authorizing Mage, you’ll be redirected back to the initial page and an access token will be in the URL as a parameter. This access token is saved in your application’s database; it never leaves your application’s database.

Add remote

Enter a name for your new remote. For the remote URL, you must use the https version of the GitHub repository (as opposed to the SSH version).

For example, the remote URL for Mage is https://github.com/mage-ai/mage-ai.git.

Note that a remote added via HTTPS/SSH authentication will not work— only a remote in the format above is accepted.

Once you fill in both input text fields, click the button labeled Create new remote.

Actions

Clone remote repository

Cloning will copy all the files and folders from the remote repository and put them into the Git directory you specified above.

Cloning won’t automatically create a folder that is named after the remote repository.

For example, if you have a file named magic.py in a remote repository named project_romeo then that file will be cloned here <your git directory>/magic.py as opposed to <your git directory>/project_romeo/magic.py.

If you want to clone the content of a remote repository into a folder named after the remote repository, then change the Git init directory above to <your git directory>/[remote repository name]

  1. Under the Actions dropdown, select the option labeled Clone.
  2. Under the Remote dropdown, select the name of the remote you want to clone from (e.g. origin).

Pull remote branch

  1. Under the Actions dropdown, select the option labeled Pull.
  2. Under the Remote dropdown, select the name of the remote you want to pull from (e.g. origin).
  3. Under the Branch dropdown, select the name of the branch you want to pull from the remote you chose from the previous step.

Branches

Switch branch

  1. Under the dropdown labeled Current branch, select the name of the branch you want to change to.
  2. After selecting a branch, the current branch will be updated to what you selected.

Create branch

  1. Type in the name of the new branch in the text input field.
  2. Click the button labeled + Create new branch.

Merge branch

  1. Under the Base branch dropdown, select the name of the branch you want to merge into your current branch.
  2. Under the Action dropdown, select the option labeled Merge.
  3. Type a commit message for the merge action.
  4. Click the button labeled Merge.

Rebase branch

  1. Under the Base branch dropdown, select the name of the branch you want to rebase into your current branch.
  2. Under the Action dropdown, select the option labeled Rebase.
  3. Type a commit message for the rebase action.
  4. Click the button labeled Rebase.

Delete branch

  1. Under the Base branch dropdown, select the name of the branch you want to delete.
  2. Under the Action dropdown, select the option labeled Delete.
  3. Click the button labeled Delete.
  4. Confirm the popup dialog box.

Files

Add files

  1. On the left side under Not staged, check the boxes next to the files you want to add.
  2. Once you’re done selecting the files, click the button labeled Add files.
  3. The selected files will be staged.

Checkout files

  1. On the left side under Not staged, check the boxes next to the files you want to checkout.
  2. Once you’re done selecting the files, click the button labeled Checkout files.
  3. Confirm the popup dialog box.
  4. All changes to the selected files will be undone.

Reset files

  1. On the right side under Staged files, check the boxes next to the files you want to reset.
  2. Once you’re done selecting the files, click the button labeled Reset files.
  3. The selected files will be unstaged.

Commit

  1. Enter a commit message.
  2. Click the button labeled Commit N files with message.

Push

Push local changes

  1. Under the Remote dropdown, select the name of the remote you want to push to (e.g. origin).
  2. Under the Branch dropdown, select the name of the branch you want to push.
  3. Click the button labeled Push [remote] [branch].

Create pull request

  1. Under the Repository dropdown, select the name of the repository you want to create a pull request for.
  2. Under the Base branch dropdown, select the name of the branch you want your pull request to compare against (e.g. main).
  3. Under the Compare branch dropdown, select the name of the branch you want your pull request to be for (e.g. feature branch).
  4. Type the title of the pull request in the text input field labeled Title.
  5. Type the description of the pull request in the text input field labeled Description.

Was this page helpful?