Git tips

Jimmy (xiaoke) Shen
1 min readAug 20, 2020

--

Local branch name

I am using jimmy as my local branch name

How to generate a new local branch

git branch jimmy
git checkout jimmy

How to check currently available branches?

(base) jimmy@jimmys-MacBook-Pro XXX % git branch* jimmymaster

the “*” indicates the currently used branch.

How to sync local to master?[1]

yes just do

git checkout master
git pull
git checkout jimmy
git merge master

to keep local branch jimmy in sync with the master branch.

then when you’re ready to put jimmy into master, first merge in master like above, then …

git checkout master
git merge jimmy
git push origin master

How to PR

https://opensource.com/article/19/7/create-pull-request-github

online tutorials

https://www.robinwieruch.de/git-essential-commands

Reference

[1] https://stackoverflow.com/questions/16329776/how-to-keep-a-git-branch-in-sync-with-master

--

--

No responses yet