Skip to content

Instantly share code, notes, and snippets.

@Chadtech
Last active October 20, 2015 21:25
Show Gist options
  • Save Chadtech/583deffe0afc4c66a3a0 to your computer and use it in GitHub Desktop.
Save Chadtech/583deffe0afc4c66a3a0 to your computer and use it in GitHub Desktop.

Yeah so to make a new branch I use the command

git checkout -b branch name

Then do push to that branch specifically is..

git push origin branch name

So once a branch is updated, github often gives you the opportunity to automatically merge, but if it doesnt then you can do 'new pull request'. When I say 'never push to master', I really mean never. The changes get merged into master through a pull request, rather that pushing directly.

Master is kind of like a source of truth, and when you make a new branch, you should start off with a copy of master..

git pull origin master

So the flow is kind of like.. 0 Dedicate new branch to new feature 1 Pull in master 2 Modify code 3 Push to new branch 4 Create pull request 5 Resolve conflicts 6 Merge with master

Yeah Im not sure how much experience you have with this. I really fucked up a client project once by getting this wrong. Always double check what branch you are on by the command

git branch

Always stay in the intended branch, avoid leaving a branch until the modifcations are done. Never pull or push to the wrong location or it will become a major headache.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment