[online documentation] (https://git-scm.com/docs)
- Set Up Terminal / Bash Commands
echo "# Git_CheatSheet" >> README.md
git init
git add README.md
git commit -m "<Commit Message>"
git branch -M main
git remote add origin <Repository Link>
git push -u origin main
- Pushing Files Terminal / Bash Commands
git remote add origin <Repository Link>
git branch -M main
git push -u origin main
- Make a copy of the repository in your local machine (be sure to go to your chosen folder first)
git clone
- Create a New Branch
git checkout -b <Branch Name>
- Apply changes to the code
- Save the changes
git add .
- Commit Changes
git commit -m "Add Details"
- Push the changes
git push origin -u <Branch Name>
- Go to repository
- Create a Pull Request then submit
- If there are no conflicts click merge changes
- Switch to the Main Branch
git checkout main
- If you can't switch branches stash your current branch
git stash
git checkout main
- Pull Repository Changes
git pull
- Checkout to your current branch
git checkout <Branch Name>
- Rebase your current Branch
git rebase main
- If you stash your current Branch
git stash pop
- Double-check if your current branch contains the changes from the main branch