Skip to main content

Git fundamentals

XetHub uses Git at its core for versioning. While we offer multiple access patterns, understanding some basic Git fundamentals and workflows can make working with XetHub easier.

What is Git?

Git is a distributed version control system typically used to track code changes in a collection of files, called a repository. Users work with copies of the repository and its history, called clones, with the option to save changes locally or push changes to a remote Git server. This allows teams to work on files in parallel, synchronizing changes as needed.

Read more about Git from the Git-SCM website.

How does this intersect with XetHub?

Git is great for versioning small files but cannot support files of over 100MB. XetHub scales Git to support larger files and repositories to bring that versioning to meet modern workflow needs. Install and authenticate with our Git extension to bring large file support to existing Git workflows. Once you have cloned a repo with git xet clone, all your usual Git commands will work on your Xet repos with no extra steps.


Common Git and Git-Xet commands

Initialize and authenticate with Git-Xet

Ensure that you have your Git credentials set as they are included in every change you make.

$ git config --global user.name "your_name"
$ git config --global user.email "your_email"

Then follow directions to install and authenticate with Git-Xet.

Create a repository

From your logged-in xethub.com view, click the + sign in the top right hand corner of the screen.

Create new repo from XetHub UI

Select the "Create repository" option. Fill out the name, visibility, and description before confirming with the Create repository button.

Clone a repository

Running this command from your terminal will download a copy of the remote repository and its history:

git xet clone <git-URL>

You can also reach this command by navigating to your XetHub repo UI and clicking the purple Access button.

note

Once you have cloned a XetHub repo with git xet clone, all usual Git commands will work on the repo without the xet specified.

Check out a branch, tag, or commit

Once you have a clone of a repository, you can quickly switch to any branch, tag, or commit.

Before starting, pull the latest from the remote to ensure you're up-to-date:

git pull

Then check out whatever you want to access:

git checkout <branch>
git checkout <tag>
git checkout <commit>

Create a branch

Create a branch to start parallel development without affecting the main repository. The command creates a new branch and switches your working directory to it.

git branch -b <branch-name>

Check repository status

Display the status of the working directory.

git status

Stage, commit, and push changes

Specify the files you want to track, add a commit message, and push your changes to the remote server.

git add <files>
git commit -m "useful commit message"
git push

Pull latest changes

Fetch changes from the remote.

git pull