Skip to content

Instantly share code, notes, and snippets.

@discdiver
Last active May 2, 2020 12:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save discdiver/a34a85e88f808414cb987882867560e0 to your computer and use it in GitHub Desktop.
Save discdiver/a34a85e88f808414cb987882867560e0 to your computer and use it in GitHub Desktop.
Basic Git Workflow with Local Branches and Pushing Directly to the Master Branch

Basic Git Branching Workflow

There are many potential Git workflows. The following is a basic workflow for someone working alone, using different local branches, pushing directly the master remote branch.

To make a new branch locally:

  1. git checkout -b my_branch_name - create and move to a new branch
  2. Do work.
  3. git status - check on things.
  4. git add . - stage changes to be committed.
  5. git commit -m "my_commit-message" - commit changes.
  6. git status - check on things.
  7. git checkout master - move to the master branch.
  8. git branch - see local branches and see which local branch you are on.
  9. git merge my_branch_name - update the master branch with the changes from the branch you were working on.
  10. git push origin master - push your local changes to your online GitHub repository.
@discdiver
Copy link
Author

Note: replace my..._ with the name/message of your choice.

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