Replacing folders with submodules in Git

I recently ran across the following problem:

Multiple people are developing on the same project, pushing commits into the same (e.g. GitHub) repo.
Developer A is working, and commits locally.
Developer B converts a folder into a Git submodule.
Developer A tries to git pull… BOOM – unresolveable conflict, local repo is left in a mess.

The problem is that [...]

git feature branch

It has been a while since I used git. To remind me, and perhaps you:

 
git checkout -b <feature_name>

Develop feature: code test commit rinse repeat.

 
git checkout master
git merge <feature_name>
git branch -d <feature_name>

My Git cheat sheet

Ultra-simple git usage:

# Initial ‘checkout’:
git clone <remote-repository>
 
# Daily process:
cd <local-repository>
git pull
# Make some changes
git add <changed files>
git commit
git push

Setting up a shared git repo:

# Assuming you have an existing project in a git repo called "./project":
mkdir project.git
cd project.git
git –bare init –shared
git –bare fetch ../project master:master
cd ..
scp -r project.git someserver:/some/shared/location
ssh server
sudo chgrp -R group_containing_all_developers /some/shared/location/project.git

Publish branch [...]

git submodules

Add a submodule:

git submodule add <repo> <path>

Cloning a repo with submodules:

git clone <repo>
git submodule init
git submodule update

You have to run ‘git submodule update’ after git pull if you want to update submodules, too.
Always publish the submodule change before publishing the change to the superproject that references it.
It’s not safe to run git submodule update if [...]

Git simple branching, published to remote

Simple git branching technique in my environment (master copies of repos hosted on my remote server):
Create new branch locally:

$ git branch <branch name>

Push the branch to the remote repository:

$ git push origin <branch name>

Now for the wrinkle: as mentioned here, the local branch is not yet tracking the remote branch. To fix this, overwrite [...]

Ultra-simple git usage

To access a shared repository (e.g. Subversion-style), using no branches, your work cycle will look like this:
Initial ‘checkout’:

git clone <remote-repository>

Daily process:

cd <local-repository>
git pull
# Make some changes
git add <changed files>
git commit
git push 

Setting up a shared (svn-like) git repository

As described here…
Assuming you have an existing project in a git repo called “project”:

mkdir project.git
cd project.git
git –bare init –shared
git –bare fetch ../project master:master
cd ..
scp -r project.git someserver:/some/shared/location
ssh server
sudo chgrp -R group_containing_all_developers /some/shared/location/project.git