git > branching
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.

(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

- 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 withgit 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

- the opposite is to merge locally and push master with
git push origin master

- merge pull request after review 🠊 changes will be merged with master

(2.6) git fetch
- locally, git is unaware of this situation

- fetch all the changes and pull requests done remotely by
git fetch

(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

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.

(4) video
sources
Originally published at http://pavol.kutaj.com on June 8, 2020.