Git workflow basics-clone, commit, push, pull
Learn Git fundamentals: clone repos, create branches, commit changes, push to remote, pull updates, merge branches.
On this page
Git is version control for code. Basic workflow: clone repo → create branch → make changes → commit → push → create pull request.
Clone a repository
git clone https://github.com/user/repo.git
cd repo
Create and switch branch
git branch feature-name # Create branch
git checkout feature-name # Switch to branch
git checkout -b feature-name # Create and switch (one command)
Commit changes
git add . # Stage all changes
git commit -m "Your message" # Commit with message
git log # View commit history
Push to remote
git push origin feature-name # Push branch to GitHub/GitLab
Pull updates
git pull # Fetch and merge latest changes
git fetch # Fetch without merging
Merge branches
git merge feature-name # Merge feature into current branch
Never commit directly to main. Create feature branches for all work, then merge via pull requests.
Related: SSH keys | Command line
Need a developer-friendly server?
Use an UnderHost Cloud VPS for SSH, Git, Node.js, Python, Laravel, Docker, cron, and custom development workflows.





















