Skip to content

Latest commit

 

History

History
73 lines (56 loc) · 2.55 KB

File metadata and controls

73 lines (56 loc) · 2.55 KB

mobilege / Git   Documentation   tldr

Git

Git Branching
$ git branch testing   # Create a new local branch
$ git checkout testing # Switch to an existing local branch

$ git checkout -b iss53 # Create a new local branch & switch to it (in one step)

https://git-scm.com/book/en/v2/Git-Branching-Basic-Branching-and-Merging

Pushing
$ git push <remote> <local branch>:<remote branch>
$ git push origin serverfix  # if the local & remote branches have the same name
$ git push  # pushes current branch, if tracking set up
$ git push --all   # pushes all branches

https://git-scm.com/book/en/v2/Git-Branching-Remote-Branches

Tracking Branches
$ git checkout -b <branch> <remote>/<branch>
$ git checkout --track origin/serverfix
$ git checkout serverfix
# Branch serverfix set up to track remote branch serverfix from origin.
# Switched to a new branch 'serverfix'

https://git-scm.com/book/en/v2/Git-Branching-Remote-Branches > 'Tracking Branches'

  • deletes refs to branches that don't exist on the remote

Miscellaneous

Multiple GitHub accounts

$ git remote set-url origin git@<host>:rabin-joshi-cognizant/cognizant-enablement.git
# <host> should match the host alias defined in ~/.ssh/config
$ git config user.name "rabin-joshi-cognizant" # updates local 
$ git config user.email "rabin.joshi@cognizant.com" # updates local 
$ git config -l # shows all: system, global and local
SSH Config
$ code ~/.ssh/config # opens the file in VS Code

using-the-ssh-config-file

https://linuxize.com/post/using-the-ssh-config-file/