Git === # Subtree Example 1. Add sub-project as remote ```bash git remote add -f RemoteName RemoteUrl ``` 2. Run `git subtree` command ```bash git subtree add --prefix Path/To/Put/Code NameOfRemote master --squash ``` 3. Pull subtree as needed ```bash git fetch NameOfRemote master git subtree pull --prefix Path/To/Put/Code NameOfRemote master --squash ``` ## Reference * http://blogs.atlassian.com/2013/05/alternatives-to-git-submodule-git-subtree # Create a branch without a parent Very useful when you are updating a project that you are rewriting. For example, say you are using semantic versioning and are wanting to start a new major version. ```bash git checkout --orphan BRANCH ``` # Delete All Branches that have been merged Great for cleaning up local branches that aren't being used any more. ```bash git checkout master git branch --merged | grep -v "\*" | xargs -n 1 git branch -d ``` # Ignore changes to a file that is being tracked Ignore: ```bash git update-index --assume-unchanged [directory|file] ``` Unignore: ```bash git update-index --no-assume-unchanged [directory|file] ``` # How to ignore dirty submodules Edit your ``.git/config`` and add ``ignore = dirty``. ```text [submodule "path/to/submodule"] path = path/to/submodule url = git://github.com/username/repo.git ignore = dirty ``` # Clone a repo and give name other than origin ```bash git clone -o upstream https://repo.git ```