Please enable JavaScript.
Coggle requires JavaScript to display documents.
GIT - Coggle Diagram
GIT
BRANCHING:
to branch is to diverge from the main line of development and continue to do work without messing with that main line.
-
-
Default branch name is main, a main branch is given to you when first committing that points to the last commit made. Every time a commit is made the branch that is pointing to last commit moves forward to the new commit just made.
-
when switching branches, if the working dir or the staging area has uncommitted changes that conflict with the branch you're checking out, git won't let you switch.
-
git resets the working dir to look like it did the last time you committted on that branch. it adds, removee, and modifies files automatically yo make sure the working copy is what the branch looked like on your last commit to it.
code-stability based branching workflow: a branching model that organizes source code into branches and promotes code upward towards more stable branches as it gets tested and validated.
long-running branches hold production-ready or release-ready code only, they often have more unstable / short-lived branches merging into them.
topic branches are short-lived, created for individual features or fixes. Local, throaway, and focused. Not sable.
The stable branches arefarther don the line in the commit history, and the bleeding-edge branches are farther up the history.
Remote references: are pointers in the remote repo, including branches, tags, and so on.
Remote tracking branches are references to the state of remote branches. They're local references that you can't move. Git moves them whenever any network communication is made, so that they accurately represent the state of the remote repo.
-
tracking branches: is a local branch that has a direct relationship to a remote branch. When pulling from a tracking branch git automatically knows which server to fetch from and which branch to merge in.
-
-
MERGE
when committing the parents are recorded, that makes merging very easy because that way finding a proper merge base is automatic.
fast-forward merge: happens between one commit and a commit that can be reached by following the first commit's history. Git simply moves the pointer forward. Theere is no divergent work to merge togheter.
combines changes from one branch into another, integrating their histories.
three-way merge: happens when the commit on the branch you're on is not a direct ancestor of the branch you're merging in. Uses the two snapshots pointed to by the branch tips and the common ancestor of the two. Git creates a new snapshot and a commit that points to it. This is called a merge commit; it has more than one parent.
merge conflict: appears when trying to merge two branches whose commit snapshots have changes in same parts of same files that differ. Git pauses th merging process to let user resolve the conflicts.
-
COMMIT
-
The object also contains the author's name and email address, the message that you typed, and pointers to the commit or commits that directly came before this commit (its parent or parents).
zero parents for the initial commit, one parent for a normal commit, and multiple parents for a commit that results from a merge of two or more branches.
Before a commit, when staging a fie, git computes a checksum for it, stores that version of the file in the .git repo (git refers to them as blobs) and adds that checksum to the staging area.
when committing, git checksums each subdir and stores them as a tree obj that has the metadata and a pointer to the root project tree so it can re-create that snapshot when needed.
-
-
If you make some changes and commit again, the next commit stores a pointer to the commit that came immediately after.
REMOTE REPOSITORY
is a version of the project that is hosted on a network. Can have more than one, each one can be either read only or read/write.
-
-
DATA REPRESENTATION:
-
A commit in git is a Snapshot of how all the files and the subdirectories in the Working directory looked like in that moment in time.
If files haven't changed, git doesn't store the file again, just a link to the previous identical file it has already stored.
GIT HAS INTEGRITY:
-
Integral to git philosophy, built at the lowest level.
-
REBASING:
used to reapply all the changes that were committed on one branch and replay them on a different branch.
works by going to the common ancestor of the two branches, getting the diff introduced by each commit of the branch you're on, saving those diffs to temporary files, resetting the current branch to the same commit as the branch you are rebasing onto, and finally applying each change in turn.
-
PUSHING:
Pushing to a remote is only possible if write access is enabled. Local branches aren't automatically synchronized to the remotes you write to, you have to explicitly push the branches you want to share.