Distributed Git

Remote (Hosted) Repo

Def: contents of project's .git directory and nothing else

❓When

One-person project

Team-based (collaboration) projects

Remote Branches

Remote references

references (pointers) in remote repos

git ls-remote [remote]: get full list of remote references

git remote show [remote]: get list of remote branches

Remote-tracking branches

Form: <remote> / <branch>

git fetch origin: Fetches changes do not have from the remote and update ur local repo - moving origin/master pointer to its new (up-to-date) position

Pushing

git push origin serverfix: Take my serverfix local branch and push it to update the remote's serverfix branch

git push origin serverfix:serverfix: Take my serverfix and make it the remote's serverfix

Centralized VCSs

Single collaboration model (centralized workflow)

Not limited to small team

If suitable, create a repo, and give every developer push access

Integration-Manager Model

Include a canonical repo, that represents the offical project

Each dev-er has write-access to their own public repo. and read-access to everyone else's

Dev-ers make their own public clone of the project and push changes to it

❗Then they inform the maintainer of the main project to pull their changes

The maintainer add dever's repo as a remote, test changes locally merge them into the branch and push back to their repo

Contributors do not have to wait for the project to incorporate their changes - each can work on their pace

Dictator and Lieutenants

Model

Lieutenants: various integration managers are in charge of certain parts of the repo

Benevolent dictator: All Lieutenants have 1 integration manager

he pushes from his directory to a reference repository ffrom which all the collab need to pull

Workflow

Regular devers work on their topic branch and rebase their work on top of master.

Lieutenants merge the devers' topic branches into their master branch

The dictator merges the lieutenants' master branches into dictator's master branch

Finally, the dictator pushes that master branch to the reference repo so the other developers can rebase on it

Use

Useful for very big projects

Highly hierarchical environments

Allows project leader (the dictator) to delegate much of the work and collect large subsets of the code at multiple points before integrating them

Contributing to a Project

Factors

Commit access

Active contributor count

Project workflow

Commit guidlines

No white space errors

run git diff --check before commits to identify and list possible white space errors

ignore warning: git config apply.whitespace nowarn

Commit logically separate changeset

Use quality commit messages

Private small Project

All dev-ers have push access to the repo

Centralized workflow with offline committing and simple branching and merging

Remote Repo

own server

Git

Pros: Fastest protocol, allow anonymous public access

Cons: Difficult to setup, lack of authentication, use non standard port (9418) which can be blocked

Hosted servers - GitHub

Audit log: records all events that have happended at the organization level, who did them and where in the world they were done

Fork Project

Contribute to an existing project to which don't have push access