0% found this document useful (0 votes)
11 views2 pages

Git Important Points

The document outlines important points about Git, including its basic concepts such as repositories, commits, branches, and merges. It provides essential Git commands for initializing repositories, staging changes, and managing branches, as well as best practices for effective version control. Additionally, it covers methods for undoing changes and working with remote repositories.

Uploaded by

Aniket Shaw
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views2 pages

Git Important Points

The document outlines important points about Git, including its basic concepts such as repositories, commits, branches, and merges. It provides essential Git commands for initializing repositories, staging changes, and managing branches, as well as best practices for effective version control. Additionally, it covers methods for undoing changes and working with remote repositories.

Uploaded by

Aniket Shaw
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Important Points of Git

1. Git Basics
- Repository (Repo): A directory containing all your project files and their history.
- Commit: A snapshot of changes made to files.
- Branch: A separate line of development.
- Merge: Combining changes from one branch into another.
- Clone: Copying an existing repository.

2. Essential Git Commands


- git init - Initialize a new repository.
- git clone <repo-url> - Clone a remote repository.
- git add <file> - Stage changes for commit.
- git commit -m "message" - Save changes to the repo.
- git status - Check current changes.
- git log - View commit history.
- git branch - View available branches.
- git checkout <branch> - Switch to a different branch.
- git merge <branch> - Merge changes from another branch.
- git pull - Fetch and merge changes from a remote repo.
- git push - Upload local commits to a remote repo.
- git reset --hard <commit> - Reset repo to a specific commit.

3. Branching & Merging


- Always create new branches for features or fixes.
- Use git merge to combine branches.
- Resolve merge conflicts manually when necessary.

4. Undoing Changes
- git checkout -- <file> - Discard changes in a file.
- git reset --soft <commit> - Undo commits but keep changes staged.
- git reset --hard <commit> - Completely reset to a previous commit.
5. Working with Remote Repositories
- git remote add origin <url> - Link a local repo to a remote.
- git fetch - Get latest changes from a remote repo.
- git rebase - Reapply commits on top of another base commit (use carefully).

6. Git Ignore
- Use a .gitignore file to exclude unnecessary files from tracking.

7. Best Practices
- Write clear commit messages.
- Commit small, logical changes frequently.
- Always pull before pushing to avoid conflicts.
- Use branches for separate tasks.

You might also like