UnderHost
Knowledgebase Docs

Git basics for web developers

Learn version control with Git: clone, commit, push, pull, and manage your code repository on VPS hosting.

On this page

Git is a version control system that tracks changes to your code, allowing you to collaborate with others, revert to previous versions, and maintain a complete history of your project.

Install Git

# Ubuntu/Debian
apt install git -y

# AlmaLinux/Rocky
yum install git -y

# Verify installation
git --version

Clone a repository

git clone https://github.com/username/repo.git
cd repo

Commit changes

# Check status
git status

# Stage files
git add .

# Commit with message
git commit -m "Fix bug in login form"

# View history
git log --oneline

Push and pull

# Pull latest changes from remote
git pull origin main

# Push your commits
git push origin main

Working with branches

# Create a new branch
git checkout -b feature/new-feature

# Switch branches
git checkout main

# Merge branch
git merge feature/new-feature

# Delete branch
git branch -d feature/new-feature
Was this article helpful?

Deploy with Git

Use Git hooks on UnderHost VPS to deploy code automatically when you push to your repository.

Related articles

Back to Developer Tools