Version control for programmers and web developers
What Is Git?
A detailed explanation of Git — what repositories, branches and commits are, what GitHub and GitLab are, and how developers use Git to deploy and maintain websites.
What is Git?
Git is a distributed version control system (DVCS) that tracks changes in code over time. It allows multiple developers to work in parallel, builds a history of all changes, enables branching for feature work and rollback to previous versions. Core commands: init, clone, add, commit, push, pull, branch, merge. Platforms: GitHub, GitLab, Bitbucket. BeoHosting cPanel has Git Version Control for auto-deploying code to the server via a webhook.
- Git = code version control
- Repositories, branches, commit, push
- GitHub/GitLab/Bitbucket platforms
- BeoHosting cPanel: Git Version Control
- Auto-deploy with a webhook
Tým BeoHosting
10+ let zkušeností — Specialisté na webhosting a infrastrukturu
- Git
- GitHub
- GitLab
- Bitbucket
- CI/CD
- Version control
- Webhook deploy
- Developer workflow
Naposledy aktualizováno:
What is Git and why do all developers use it?
Git is a distributed version control system (VCS) created by Linus Torvalds in 2005 — the same person who created Linux. Git tracks every change in your code and lets you return to any previous version at any moment.
Imagine you are writing a document and want to save every version — Git does that automatically for your code. Every change is recorded with a description, an author and a timestamp. If something goes wrong, you can instantly revert to the last correct version.
Git je danes industrijski standard — uporablja ga več kot 90% programerjev po svetu. Od majhnih freelance projektov do Googla, Facebooka in Microsofta je Git osnova vsakega resnega razvojnega procesa. Z VPS gostovanjem BeoHosting lahko nastavite Git-based deployment za samodejni deploy vaše strani.
Core Git concepts
Understanding these 6 concepts is enough to start working with Git.
Repository (Repo)
A folder that contains your project and the complete history of all changes. It can be local (on your computer) or remote (on GitHub/GitLab). Each project usually has one repository.
Commit
A snapshot of your code at a particular moment. Each commit contains the changes, a message describing them, an author and a timestamp. Commits form the "timeline" of your project.
Branch
A parallel line of development. The main code is on the "main" branch. When you want to add a new feature, you create a new branch, make changes, and when finished, merge it back into main.
Merge
Combining one branch into another. When you finish work on a new feature in your branch, the merge combines it with the main code. Git automatically resolves most conflicts.
Pull Request (PR)
A request to merge your branch into the main branch. The team can review your changes, comment, request fixes and finally approve the merge. Key to teamwork.
Clone / Fork
Clone makes a copy of the repository on your computer. Fork makes a copy on your GitHub account. Fork is used for contributions to open-source projects — you fork, make changes, then send a Pull Request.
GitHub, GitLab and Bitbucket — Git hosting platforms
These platforms host your Git repositories in the cloud and add features for teamwork.
GitHub
100M+ usersThe most popular platform with 100+ million users. Owned by Microsoft. Ideal for open-source projects, portfolios and collaboration. Free for public and private repositories.
GitLab
30M+ usersA complete DevOps platform with built-in CI/CD, a container registry and monitoring. Popular in enterprise environments. It can be installed on your own server (self-hosted).
Bitbucket
10M+ usersAtlassian's platform that integrates excellently with Jira, Trello and Confluence. Popular among teams that already use Atlassian tools. Free for small teams (up to 5 users).
How developers use Git to deploy a website
Git-based deployment is a modern approach that automates putting code onto the server.
Local development
The developer writes and tests code on their own computer. They use Git to track all changes.
Commit and Push
When satisfied with the changes, the developer commits the code and pushes it to GitHub/GitLab.
Code Review
The team reviews the changes through a Pull Request. They comment, suggest improvements and approve the merge.
CI/CD Pipeline
Automated tests run. If all tests pass, the code is automatically deployed to the staging/production server.
Deploy to the server
The new code is live on the server. If a problem appears, Git enables an instant rollback to the previous version.
Za Git-based deployment je potreben strežnik z dostopom SSH — VPS gostovanje BeoHosting vam s korenskim dostopom omogoča popoln nadzor nad strežnikom, idealen za postavitev CI/CD pipeline in avtomatiziran deploy.
The most important Git commands to start with
These 10 commands cover 90% of daily work with Git. All commands are entered in a terminal (Command Prompt, PowerShell or Terminal on Mac).
git initInitializes a new Git repository in the current foldergit clone <url>Downloads (clones) a repository from GitHub/GitLab to your computergit statusShows the status of changes — which files are modified, added or deletedgit add .Adds all modified files to the staging area (preparation for a commit)git commit -m "message"Saves the changes with a descriptive message — creates a new "snapshot" of the codegit pushSends your commits to the remote repository (GitHub/GitLab)git pullFetches the latest changes from the remote repository to your computergit branch <name>Creates a new branch for parallel developmentgit checkout <branch>Switches to another branchgit merge <branch>Merges the specified branch into the current branchRelated pages
Mohlo by vás také zajímat
VPS Hosting
Root access for Git deploys
What is FTP?
An alternative way to transfer files
What is a Linux server?
The foundation of web hosting
Hosting for the IT sector
Hosting tailored to developers
Připraveni spustit svůj web?
Připojte se k více než 4 000 spokojeným zákazníkům. Bezplatná migrace a 15denní záruka vrácení peněz.
Frequently asked questions about Git
Odpovědi na nejčastější dotazy o našich službách.
Naše záruky pro váš klid
Chráněni ze všech stran
15denní záruka
V prvních 15 dnech vracíme peníze bez otázek.
Bezplatná migrace
Váš web přemigrujeme bez výpadku — vy neuděláte nic.
Podpora 24/7
Naši odborníci jsou tu 24/7 prostřednictvím ticketů a live chatu.