git remote add <origin_name> <url_of_the_remote_repo>
git remote set-url <origin> <url_of_the_remote_repo>
git remote
git remote -v
git remote rename <current_remote_name> <updated_remote_name>
git remove <remote_name>
git fetch <remote_name>
git fetch <remote_name> <branch_name>
git merge <remote_name>/<branch_name>
git rebase <branch_name>
git pull
git pull <remote_name>
git pull <remote_name> <branch_name>
git pull origin master
fetches commits from the master branch of the origin remote (into the local origin/master branch), and then it merges origin/master into the branch you currently have checked out.
git pull
only works if the branch you have checked out is tracking an upstream branch. For example, if the branch you have checked out tracks origin/master, git pull
is equivalent to git pull origin master
# Merge remote branch origin/foo into local branch foo,
# without having to checkout foo first:
git fetch origin foo:foo
git branch -a
git checkout <existing_branch>
git checkout -b <branch_name>
git checkout <commit_hash>
git switch -c "in-app-messaging-fix"
git clone -b <branch_name> <remote_repo>
git branch -d <branchname>
git clone -b <branch_name> --single-branch <remote_repo>
- [Non-Force]
git branch -d <branch_name>
- [Force]
git branch -D <branch_name>
git push <remote_name> --delete <branch_name>
or
git push <remote_name> :<branch_name>
git rm --cached filename
git rm -r --cached .
git log
git log -<number_of_history>
git log --oneline
q
to exit and z
to navigate next page
git diff
git commit --amend
git log --graph