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. We built our Git extension to bring large file support to existing Git workflows. You can leverage all of these commands on your Xet repositories with no extra steps.


Common Git commands

Initialize your Git profile

Ensure that you have your 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"

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.

To develop this newly created repository from your machine, click the purple Access button and copy the git xet clone command. Run the command from your terminal:

git xet clone <git-URL>

Clone a repository

Cloning downloads a copy of the remote repository and its history to your local machine.

git clone <git-URL>

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