Skip to content

Instantly share code, notes, and snippets.

# Case 1: You checked out a new branch from your local repository, with git checkout -b <new branch>
git push --set-upstream <remote branch, usually 'origin'> <local new branch> # this is also proposed from git itself if you git push

# Case 2: You checked out an existing repository and rebase went fine
git push

# Case 3: You checked out an existing repository and rebase had conflicts that you solved
git push --force-with-lease
# Check the files in your workspace that have been changed after rebasing
git status

# Select all files to put be in stage and commit thereafter
git add <files-changed-in-workspace-after-rebase> # if you want all files to be put in stage, then $ git add .

# Optionally, verify that all the files you wanted in stage area are set
git status
# get the latest changes from the remote tracking branch
git fetch -p

# update the local branch by rebasing from the remote tracking branch
git rebase
# Check the files in your workspace that have been changed and verify you are in the correct branch
git status

# Select the files you want to put in stage and commit thereafter
git add <files-in-workspace-to-be-staged-space-separated> # if you want all files to be put in stage, then  $ git add .

# Optionally, verify that all the files you wanted in stage area are set
git status
# update the dev/<featureA> branch
git checkout dev/<featureA>
git fetch -p
git merge

# checkout the existing local branch
git checkout <local-branch> # e.g. git checkout dev/featureA$feat/Login
git merge                   # merge possible changes made in remote-branch that the local branch tracks. There may appear conficts fix them first and then continue.
git rebase dev/ # if there were changes in dev/, then after having merged twice above, re-base the  on dev/ to apply all changes again on the new base that is set from the dev/
# update the dev/<featureA> branch
git checkout dev/<featureA>
git fetch -p
git merge

# checkout the existing remote branch
git checkout <remote-branch> # e.g. git checkout dev/featureA$feat/Login
git rebase dev/<featureA>    # if there were changes in dev/<featureA>, then after having merged above, re-base the <remote-branch> on dev/<featureA> to apply all changes again on the new base that is set from the dev/<featureA>
git checkout dev/<featureA>
git fetch -p
git merge

# create new branch
git checkout -b <new branch> #(convention: <new branch> should follow this instruction: dev/<featureA>$<type-of-change>/<name-of-feature-or-component-affected-by-changes>)
# e.g. git checkout -b dev/featureA$feat/Login

# optionally, just to verify you are in the correct branch
git clone http://<username>@<remote-project-directory>.git

git checkout master
git checkout -b <development branch> # e.g. git checkout -b dev
git checkout -b <development feature branch> # e.g. git checkout -b dev/featureA

# optionally, just to verify you are in the correct branch
git branch
# Check the files in your workspace that have been changed and verify you are in the correct branch
git status

# Select the files you want to put in stage and commit thereafter
git add <files-in-workspace-to-be-staged-space-separated> # if you want all files to be put in stage, then  $ git add .

# Optionally, verify that all the files you wanted in stage area are set
git status
[Issue-Code] <type>(<scope>): <subject>
<BLANK LINE>
<body>
<BLANK LINE>
<footer>