Git - Working with branches In this quick article, I will: * quickly create a branch on a git repository. * make some commits * push them to a remote branch * clone to a new location (to simulate working on another machine) * merge the new branch to master * delete the local and remote branches --- Reminder - This site is mainly for my memory and reference. You can find this information anywhere out on the web, but I find the best way to remember something is to write it down yourself. Firstly, clone a repo and cd into it. __make a new local branch__ git checkout -b updates/onedrive Now, make some commits and we will push this to a new remote branch like this: __push to remote branch__ git push -u origin updates/onedrive _note, the remote and local branch names need not match_ _second note, `-u` stands for --set-upstream-to_ Next, go to another computer where you will resume work. (or for the sake of practice, just clone again to another directory) On the new clone, we need to fetch all other branches __download all branches__ git fetch origin __create a local branch, pull the remote branch to it__ git checkout -b updates/onedrive git pull origin updates/onedrive Here we can examine the branch, continue to make changes and commits. If we want to push back to the remote branch, we need to set the upstream: git push -u origin updates/onedrive When we are done, perhaps we want to merge the changes back to master. In that case: __merge changes to master__ git checkout master git merge updates/onedrive Now would be a good time to push changes. Then you can delete the local and remote branches. __delete local branch__ git branch -d updates/onedrive __delete remote branch__ git push --delete origin updates/onedrive I hope this information helps me, let alone you! Helpful links [stackoverflow](https://stackoverflow.com/questions/2003505/how-do-i-delete-a-git-branch-locally-and-remotely) [stackify](https://stackify.com/git-checkout-remote-branch/) [git-scm.com](https://git-scm.com/book/en/v2/Git-Branching-Basic-Branching-and-Merging) [freecodecamp.org](https://www.freecodecamp.org/forum/t/push-a-new-local-branch-to-a-remote-git-repository-and-track-it-too/13222) Tags: git