Skip to content

Instantly share code, notes, and snippets.

@VeronicaM
Created March 24, 2017 16:42
Show Gist options
  • Save VeronicaM/fc88f1df47cdf606c9380f88c710c097 to your computer and use it in GitHub Desktop.
Save VeronicaM/fc88f1df47cdf606c9380f88c710c097 to your computer and use it in GitHub Desktop.
• Always checkout master branch first with git checkout master
• Do a git pull origin master to bring in the latest changes
• Now create a new branch to work on a new feature with git branch your-branch-name
• Switch to your new branch with git checkout your-branch-name
• Start coding stuff
• Do git status to see what you will be committing to git
• Do git add -A to add everything or add only what you want to add with git add filename
• Do a commit with git commit -m "type message about your commit here"
• Push to the remote branch with git push origin your-branch-name
• Go over to the github repo page and do a pull request (PR) on your branch and wait for someone to check it out and merge your updates to master
• As a reviewer, before updating the master it's recommended that you merge any available pull request if needed so merging conflict don't arise in the Pull Request afterwards.
• After your branch has been merged with master you can delete it and start a new one through the same process described above
• Other useful commands are for example git stash, if you want to do a pull from master and you have some changes that you no longer want to keep.
• Also if you haven't finished working on your branch and there have been changes pushed to master, do a git pull origin master on your git local feaute-branch so you can incorporate the latest master code
This will also ensure that your branch can be incorporated into master without conflicts when you do your Pull Request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment