Skip to content

Instantly share code, notes, and snippets.

@slugbyte
Last active March 18, 2016 17:00
Show Gist options
  • Save slugbyte/abe63ba6a1d4700370a3 to your computer and use it in GitHub Desktop.
Save slugbyte/abe63ba6a1d4700370a3 to your computer and use it in GitHub Desktop.

Working With Branches

Creating a Branch

  • make sure ur in the master branch by typing git branch
  • what ever branch you are in witll be green and have a * before it
  • if you not in master commit any current changes then run git chechout master to switch to the master branch
  • Make sure your branch is up to date with github by running git pull origin master
  • Now your ready to create a new branch
  • to create a new branch run git checkout -b name-of-branch
  • name your branch after the feature you will be working on
  • you now are working in a new branch

Pushing you changes to github

  • every time you stage changes and then commit you want to push your changes to your branch on github to keep it up to date.
  • run the command git push origin name-of-branch

Create a Pull Request

  • On Github, on the main page of your repository, navigate to the branches tab.
  • Find your branch in the list and click the assosiated New Pull Request button.
    • That will Open a new page
  • Leave some short Comments about the why and what you did.
  • click the Create Pull Request button

Merge a Pull Request

  • On Github on the main page of your Repository, navigate to the Pull Requests Tab.
  • click on the link to your open pull request.
  • Now you are looking at an Open Pull Request
  • Click on the Files Changed Tab and Review the changes to your code base.
  • If the code will not break your project
  • Switch back to the conversation tab
  • Click Merge Pull Requeset
  • then Click Confirm Merge
  • then you can optionaly click Delete Branch
  • If the code will break your project
  • Switch back to the conversation tab
  • Click Cancel Pull Requeset
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment