[Learning Git] Co-working

This is the personal study note for remembering and reviewing what I learned about Git.

Commands
git clone remote_location clone_name: To copy the project in remote_location to the local with clone_name
cd directory_name: move to the directory_name
git remote -v: To see the list of remotes
git fetch: To up-to-date the project on your local. It does not update master branch, but the origin/master branches only which is the remote branch. It does not actually change any of local files. Basically, it means create another remote branch which is called origin/master on local and downloads all the commits to the new branch. HEAD stays where it were.
git fetch origin branch_name: To update origin of branch_name on local with branch_name on the remote. It does not update the non-remote branch, it only downloads the commits.
git fetch origin (source):(destination): To update the (destination) on local with the (source) on remote. If the destination does not exist on local, it will create the new branch automatically.
git fetch origin :branch_name: To create a branch_name on local.
git merge origin/master: To merge the local copy which is on the origin/master branch into the local master branch.
git pull: To fetch and merge at once. HEAD changes to the updated location.
git pull origin branch_name: To fetch and merge the branch_name on remote to origin of branch_name on local.
git pull origin (source):(destination): To fetch (source) on remote to (destination) on local and merge the (destination) into currently checked out branch. If the destination does not exist, it will create a new branch.
git push: To update the remote with local work.
git push origin branch_name: To push origin to the branch_name on both local and remote without change of HEAD location, so co-worker can review and merge into their master branch.
git push origin (source):(destination): To set the location of origin of (destination) at (source) on local and push the source to destination on remote. Note that it is possible to create a new branch on the remote repository in case it does not exist on remote.
git push origin :branch_name: To delete branch_name on both remote and local.
git fakeTeamwork: To update the remote branch??
git pull – -rebase; git push: To pull the remote data to local and rebase, then push local data to remote.
git pull; git push: To pull the remote data to local and merge, then push local data to remote.

pull, rebase, push
pull, (merge), push

** Note
When we checkout to origin/master and commit this branch, git put us into detached HEAD mode and then did not update origin/master when we added a new commit. This is because origin/master will only update when the remote updates.

I am studying these from the web https://www.codecademy.com/learn/learn-git with seven days free trial, and https://learngitbranching.js.org/ which is totally free to learn.