Skip to content

Instantly share code, notes, and snippets.

@dcchambers
Last active June 20, 2017 19:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dcchambers/854d9be97d73088af695000fd3d8fc21 to your computer and use it in GitHub Desktop.
Save dcchambers/854d9be97d73088af695000fd3d8fc21 to your computer and use it in GitHub Desktop.
Super Basic Git Workflow

Super basic git workflow and commands:

  1. Clone the master repository onto your local machine.
 $ git clone [url] 
  1. Create a new branch on your local machine to work on a feature.
 $ git checkout -b [new_branch_name] 
  1. Push the branch to github.
 $ git push origin [new_branch_name]
  1. Add a remote for your branch.
 $ git remote add [new_remote_name] [git url] 
  1. Make changes to local files.

  2. Stage the changes you want to commit.

 $ git add [file_name] 
  1. Commit the changes.
 $ git commit -m '[message here]' 
  1. Push the commit to your branch.
 $ git push origin [new_branch_name/new_remote_name] 
  1. You can now submit a pull request and merge these changes into Master on github.

  2. Once your changes have been accepted and you are done with this branch, you can delete it.

  3. Switch back to the master branch.

 $ git checkout master 
  1. Update your local master with the changes from the repository.
 $ git pull 
  1. Delete the branch you created.
 $ git branch -d [new_branch_name] 
  1. Delete the branch on the remote github repository.
 $ git push origin :[new_branch_name] 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment