abstract

The concern is to document the branching git workflow with the step into pull requests on GitHub. This can be abbreviated as cloning 🠊 branching 🠊 pushing 🠊 merging 🠊 fetching 🠊 merging.

Image for post

(1) init notes

  • the following is a personal analysis of Git Feature Branch Workflow ~ Atlassian Git Tutorial
  • … which is a git workflow, where to work on anything, really, you do the work in your own branch and merge it at an opportune moment, at a proper “junction”
  • the work is encapsulated so that the main codebase (origin/master) is not disturbed

(2) process

(2.1) clone

  • branches are labels on the SHA-1 hashes of the individual commits
Image for post
  • they follow the commits of the DAG

(2.2) checkout branch

  • git checkout -b new_branch

(2.3) commit changes

  • save changes to the file
  • stage by git add foo.bar
  • commit bt git commit -m "foobar changed"

(2.4) push branch

  • push the local branch to git push origin new_branch
  • you could also git push -u origin new_branch and start pushing with git push from that moment onwards as -u flag defines the branch as the default upstream branch

(2.5) pull request

  • Creating a pull request — GitHub Help
  • this is specific to the repo management tool
  • the pull requests mean the signal the work is done and you are requesting the master branch to pull it to itself (to merge)
  • this mechanism allows discussion and feedback and transparency
Image for post
  • the opposite is to merge locally and push master with git push origin master
Image for post
  • merge pull request after review 🠊 changes will be merged with master
Image for post

(2.6) git fetch

  • locally, git is unaware of this situation
Image for post
  • fetch all the changes and pull requests done remotely by git fetch
Image for post

(2.7) git merge origin/master

  • merge the changes fetched from the origin/master into the local master
  • in effect, local repo’s master branch is identical to the remote origin
Image for post
  • git pull does the same thing in the same way

(3) final note: fork vs branch

In git, branch is a lightweight thing that is often temporary and may be deleted. A fork (on GitHub) is a new project that is based on a previous project. You clone a repository to do work on it as a team member.

https://softwareengineering.stackexchange.com/a/237506

Image for post

(4) video

sources

Originally published at http://pavol.kutaj.com on June 8, 2020.

Written by

today I learnt… | as a support eng of the wonderful Snowplow Analytics, expect everything around modern (postmodern?) business intelligence

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store