This guide provides a quick reference for basic Git commands on Ubuntu. Git is a powerful version control system widely used for collaborative development.
Install Git on Ubuntu:
sudo apt update
sudo apt install git
Configure your name and email:
git config --global user.name "Your Name"
git config --global user.email "your.email@example.com"
Clone a remote repository to your local machine:
git clone https://github.com/username/repository.git
Check the status of your local repository:
git status
Create or modify files in your working directory.
Stage changes for commit:
git add filename
Commit changes with a descriptive message:
git commit -m "Your commit message"
Create a new branch:
git branch new-branch
Switch to the new branch:
git checkout new-branch
Merge changes from one branch into another:
git checkout target-branch
git merge source-branch
Push changes to a remote repository:
git push origin branch-name
Pull changes from a remote repository:
git pull origin branch-name
View commit history:
git log
These are some basic Git commands to get you started. Explore more Git functionalities as you continue with your development projects.
Go back to GitHub Guide.
Visit other Developer Guides.