GIT GUIDE
GIT GUIDE
• Example:
• Key Points:
2. git config
• Purpose: Set configuration values for your Git installation
• Types of Configuration:
# Set email
git config --global user.email "your.email@example.com"
3. git add
• Purpose: Stage changes for commit
• Variants:
4. git commit
• Purpose: Save staged changes to the repository
• Common Options:
5. git clone
• Purpose: Create a copy of a remote repository
• Example:
6. git remote
• Purpose: Manage connections to remote repositories
• Common Commands:
# Rename a remote
git remote rename old-name new-name
7. git push
• Purpose: Upload local repository changes to a remote repository
• Common Usage:
8. git pull
• Purpose: Fetch and merge changes from a remote repository
• Example:
9. git fetch
• Purpose: Download changes from remote without merging
• Usage:
• Commands:
# List branches
git branch
# Delete a branch
git branch -d feature-login
• Usage:
# Switch to an existing branch
git checkout feature-branch
• Example:
Best Practices
• Always pull before pushing
• Write clear, descriptive commit messages
• Use branches for new features
• Avoid force pushing to shared branches
• Regularly communicate with team about branch changes
Workflow Recommendation
1. Create branch for new feature
2. Make changes and commit frequently
3. Push branch to remote repository
4. Create pull request
5. Review and merge changes
6. Delete feature branch after merging