Configure a remote for a fork
1. List configured current repository
git remote -v
> origin https://github.com/YOUR_USERNAME/YOUR_FORK.git (fetch)
> origin https://github.com/YOUR_USERNAME/YOUR_FORK.git (push)
2. Configuring remote for a fork
git remote add <give- name-for-fork-repo> <forked ssh url>
$ git remote add upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git
3. Verify new forked remote repo addition in the previous step
git remote -v
> origin https://github.com/YOUR_USERNAME/YOUR_FORK.git (fetch)
> origin https://github.com/YOUR_USERNAME/YOUR_FORK.git (push)
> upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git (fetch)
> upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git (push)
Create a new branch
1. git checkout master
2. git pull origin master #updates the local master
3. git checkout -b <feature branch>
Rebase
1. git checkout master
2. git pull origin master
3. git checkout <feature branch>
4. git rebase -i master
Squash commits
5. %s/pick/s/g
Edit commit
1. git commit --amend
Resolve Merge Conflicts
1. Resolve merge conflicts
2. git add -A
3. git rebase --continue
4. git push s <feature branch>
5. <create a PR From:s/<feature branch> To: origin/master >
6. Once the PR is merged
a. git checkout master
b. git pull origin master
c. git push —delete s <feature branch> $delete remote branch
d. git branch -D <local branch name> #delete local branch
e. git push origin --delete <remote branch> #delete remote branch