DISCLAIMER: Mainly for my reference, use at your own risk
-
Set a new remote
git remote add origin https://github.com/user/repo.git
-
Do the initial commit
git commit -m 'Initial Commit'
-
Verify new remote
git remote -v
-
Remove remote
git remote rm "remoteName"
git clone <repo url>
git rm -r --cached .
git add .
Add New Branch command: git checkout -b <branch name>
List Branches command:git branch
Delete Local Branch command:git branch -d <branch name>
Delte Remote Branch command: git push <remote_name> :<branch_name>
Different between git pull
and git fetch
git pull is shorthand for git fetch followed by git merge FETCH_HEAD
Basically pulls latest commit from remote repo
To make git track all new files
git add .
Make sure to add upstream branch for git to push to:
git push --set-upstream <repo name> <branch>
i.e. git push --set-upstream origin master>
Push commit to remote repo
git push
Commit changes to a branch branch: git commit -m "Updated git commands"
- Checkout the branch you want to merge to.
git checkout <branch>
- Then merge
git merge <branch to merge>