List all branches:

git branch -a

Create a local branch

git checkout -b dc-server-modification

switch to master after creating branch

git checkout master

switch to branch

git checkout dc-server-modification

Create a remote branch under origin/master

git branch -t dc-server-modification origin/master

Checkout locally remote branch

git checkout -b dc-server-modification

Push to remote branch

How do you merge your changes performed on the branch with the master, while you are there on the branch?
git branch -a : “check the branch on which you are on”
git checkout dc-server-bug-fixes : “checkout the branch”
//Make changes
git add -A && git commit -m “bug fixes”
git status : “check up to date”
git rebase master : Rebase on master happens
git checkout master
git merge dc-server-bug-fixes: “merges all changes master”
git push -u origin master

The following steps might help anyone who are new to git rebase and wanted to do it without hassle

Step 1: Assuming that there are no commits and changes to be made on YourBranch at this point. We are visiting YourBranch.

git checkout YourBranch
git pull –rebase
What happened? Pulls all changes made by other developers working on your branch and rebases your changes on top of it.

Step 2: Resolve any conflicts that presents.

Step 3:

git checkout master
git pull –rebase
What happened? Pulls all the latest changes from master and rebases master on latest master.

Step 4: Resolve any conflicts that presents.

Step 5:

git checkout YourBranch
git rebase master
What happened? Rebase on master happens

Step 6: Resolve any conflicts, if there are conflicts. Use git rebase –continue to continue rebase after adding the resolved conflicts. At any time you can use git rebase –abort to abort the rebase.

Step 7:

git push –force-with-lease
What happened? Pushing changes to your remote YourBranch. –force-with-lease will make sure whether there are any other incoming changes for YourBranch from other developers while you rebasing. This is super useful rather than force push. In case any incoming changes then fetch them to update your local YourBranch before pushing changes.

Why do I need to push changes? To rewrite the commit message in remote YourBranch after proper rebase or If there are any conflicts resolved? Then you need to push the changes you resolved in local repo to the remote repo of YourBranch

Yahoooo…! You are succesfully done with rebasing.

You might also be looking into doing:

git checkout master
git merge YourBranch : “merges the branch with your master”
git push -u origin master : “pushes to master”