Git and GitHub Full Guide
Git and GitHub Full Guide
https://git-scm.com/downloads
touch lend.txt
git init
git add lendi.txt
git commit -m “new file”
git branch -M main
git remote add origin https://github.com/yannan-123/sample.git
git push -u origin main
git status
git add .
git commit -m “first”
git push
Git Basics
Repository Management
1. Initialize a repository:
git init
2. Clone a repository:
git add .
4. Commit changes:
git status
6. View commit history:
git log
Branching
2. Switch to a branch:
git branch
6. Delete a branch:
Collaboration (Pushing/Pulling)
git pull
git fetch
4. Check the remote repository URL:
git remote -v
Stashing
git stash
Tagging
git tag
GitHub Basics
4. Fork a repository:
o Click the Fork button on GitHub to create your copy of a
repository.
Git Ignore:
To exclude files from being tracked, create a .gitignore file in your
repository with the names or patterns of files to ignore.
Resolving Merge Conflicts:
When you encounter merge conflicts: