Centralized Workflow
Overview
Everyone develops of master.
Regular commits are essential.
Simulation Setup
You will need two git accounts. A root account and then all others get invited into to the repo. In one location on my machine I created the project and linked it to the root git repo. I then git cloned from the invited team member’s git repo the project into another location on my machine. So the same project in two locations on my machine, each location tied to a different git accounts, the git accounts have a shared repo
One team member (root user) creates a remote git repo (the root account)
Invite the other team member into this root account. Once they accept, the root repo will appear in their account
Someone in the team must set the project up, they push this to the root repo
Other team members clone the project. Once cloned they can begin to work on their part of the project
Root user creates assets and pushes them to master
Team member 2 creates some assets and attempts to push them to master
A git conflict occurs
User git pull --rebase origin master
git pull is like using svn update
--rebase option tells Git to move all of Mary’s commits to the tip of the
master
branch after synchronising it with the changes from the central repository. The pull would still work if you forgot this option, but you would wind up with a superfluous “merge commit” every time someone needed to synchronize with the central repository. For this workflow, it’s always better to rebase instead of generating a merge commit.
Team 2 member begins to resolve conflicts if their any, git will indicate there conflicts using the following message
Team 2 member can resolve their conflicts using git status, it will show something like
# Unmerged paths: # (use "git reset HEAD <some-file>..." to unstage) # (use "git add/rm <some-file>..." as appropriate to mark resolution) # # both modified: <some-file>
Resolve the conflicts if there are any, then use the following commands
git add <some-file> git rebase --continue
Git will move onto the next conflict
Once completed, execute git push origin master
If things get confused and messed up on the merge execute a git rebase --abort, this will revert everything back to the start
Gitflow Workflow