Master Git


Welcome to the Git Course.
Thank you for choosing to learn Git with me. This course provides a solid foundation in version control, helping you manage your projects efficiently. If you find this course helpful, please leave a ⭐️ on my GitHub.
What is Git
Git is a free, open-source distributed version control system designed to handle projects of all sizes quickly and efficiently. It helps developers track changes in their code, collaborate with others, and manage different versions of a project over time.
Key Features of Git:
Version Control: Tracks changes to files, allowing you to revert to earlier versions if needed.
Distributed System: Every developer has a complete copy of the repository, enabling offline work and better data security.
Branching and Merging: Supports parallel development by letting you create separate branches for features or fixes, then merge them back into the main codebase.
Collaboration: Git enables teams to work together efficiently by managing code contributions and resolving conflicts.
Speed and Efficiency: Optimized for performance, even with large projects.
Installation and Setup Github :
Windows / Linux (Ubuntu)
sudo apt install git-all
MacOS
brew install git
After installation, you can check if Git is installed.
git --version
Official Manual of Git
man git
Navigation Shortcuts:
• q
: Quit the manual and return to the terminal.
• j
: Move one line down.
• k
: Move one line up.
• d
: Scroll half a page down.
• u
: Scroll half a page up.
Search Shortcuts:
• /<term>
: Search for a specific term in the manual.
• n
: Go to the next occurrence of the search term.
• N
: Go to the previous occurrence of the search term.
Steps for Quick Git Configuration
1. Check Current Configurations
Run these commands to check if your Git identity is already set:
git config --get user.name
git config --get user.email
2. Set Your Identity
If the values aren’t set, use the following commands to add them globally (replace with your details):
git config --add --global user.name "github_username_here"
git config --add --global user.email "email@example.com"
3. Set a Default Branch
Configure Git to use <branch> as the default branch for new repositories:
git config --global init.defaultBranch <branch>
Verify Your Configuration
To ensure your settings were saved, check the contents of your global configuration file:
cat ~/.gitconfig
Example Output (~/.gitconfig):
[user]
name = github_username_here
email = email@example.com
[init]
defaultBranch = master
Subscribe to my newsletter
Read articles from Narsi Bhati directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Narsi Bhati
Narsi Bhati
Highly motivated and results-driven Software Engineer with hands-on experience in full-stack development, including expertise in languages such as Go, TypeScript, Proficient in technologies like React, Node.js, Next.js, Docker, and cloud platforms such as Amazon Web Services (AWS). Skilled in problem-solving with a proven track record of delivering scalable, along with a commitment to continuous learning and professional growth. A team player with a growing ability to collaborate effectively in cross-functional teams. Eager to learn and contribute to innovative projects while building technical skills and staying up-to-date with the latest technology trends.