# merge master and feature-branch
git checkout master
git pull origin master
git merge feature-branch
git push origin master
git merge --abort
git branch -d feature-branch
In bash/gitignore_global there is a list of common patterns I would like git to systematically ignore (based on https://gist.github.com/octocat/9257657).
git config --global core.excludesfile bash/gitignore_global
gitignore.io is a useful tool to create custom .gitignore
files.
Submodules are a way for a git repository to include other git repositories, specifically a commit. When that repository is changed, we can pull, switch branches, etc. and save the new status of the submodules.
git submodule add ssh://git@github.com/USER/PROJECT.git
Submodules are just like any other git repository, so they accept any operation you would expect. However, as stated above, they point at a specific commit. So no matter what changes you do, just commit them and make sure the repository is checked-out at it.
git clone --recursive ssh://git@github.com/USER/PROJECT.git
Solution proposed by CodeWizard:
git submodule deinit REPO/PATH
git rm REPO/PATH
git rm --cached REPO/PATH
rm -rf .git/modules/REPO/PATH
Sometimes we clone the repository using the HTTPS URL, or for some other reason, we are not using the SSH access. The later is quite convenient, since it allows to use the SSH keys for automatic login. Additionally, sometimes HTTPS won’t work because of the network settings, and the command (e.g. git pull
) will do nothing, returning a timeout error after a while. To change it:
git remote set-url origin ssh://git@github.com/USER/PROJECT.git