# Make a new branch ``` git branch ``` # Show branches (* is the active/current branch) ``` git branch ``` # Check/view the other branch ``` git checkout ``` # Combine target branch with working branch for example, we want to merge other branch to main branch ``` git checkout main git merge ``` # Merge branch from local to remote ``` git checkout main # switch to main branch git pull origin main # get the latest changes in main branch git merge # merge with the update branch git push origin main # upload the changes to master ``` # Handling a merge conflict. once you have applied the changes to merge conflict, you can type: ``` git add . git merge --continue ``` to continue merging after the merge conflict # To cancel merging process ``` git merge --abort ``` # Rebasing makes it look like you split off from a branch # at a different commit (usually latest) ``` git rebase master ``` # Rebase Conflict (solve the conflict first) then type: ``` git rebase --continue ``` # to abort rebase ``` git rebase --abort ``` # Git Remote - Upload Local to Remote Repository (Github) ``` cd local git git checkout master git remote add origin git push origin main ``` # Download/Fetch changes in a branch from remote ``` git pull origin main ``` # Renaming a Git Branch (Local and Remote) ``` git checkout # switch to local branch you want to rename git branch -m # Rename local branch to desired name git push origin - u # Push the new local branch name and reset the upstream git push origin --delete # Delete the old_name remote branch ``` # Download/Clone a repository from github ``` git clone https://github.com/microsoft/vscode.git ```