Skip to content

Try our new Crash Courses!

Buy one of our new Crash Courses, now hosted on Podia.

Advanced workflow – GitHub

Details

Here’s an advanced Git workflow you can use to practice branching, staging files, making commits, and pushing and pulling changes to and from a remote repo.

Setup

  • Create your project folder.
  • Create some files and write some code.
  • Initialize the Git repo.
  • Make an initial commit on the master branch (this is so the master branch will actually get created).
  • Create a feature/topic branch and switch to it.
  • Create a remote repository.
  • Add the remote repository to your project.
  • Push your local changes up to the remote repository.

The second and third steps in the setup can be flipped if you prefer to initialize the repo first.

Workflow

  • Write some code and save your files.
  • Stage the files you want to commit.
  • Commit the changes.
  • Push the changes up to your remote repo.
  • After you’ve completed your feature, you can open a pull request.
  • Merge your changes into master using the pull request.
  • Use git fetch to retrieve your changes from your remote repo and merge them into your local master branch.
  • Create a new branch when it’s time to add more changes.

References

Recording Changes to the Repository from the Git Pro book

Basic Branching and Merging from the Git Pro book

Back to: GitHub Reference