Git Notes

Some git notes or future reference:

Get all changes between two tags that modify certain files.

FILES=$(git diff --name-only remotes/origin/aosp-new/ics-mr1-release ics | grep -i blue)
git log --no-merges --stat remotes/origin/aosp-new/ics-mr1-release..ics ${FILES}

Replace AOSP repository with one from CodeAurora

cd external/bluetooth/bluez
git remote add ca git://codeaurora.org/platform/external/bluetooth/bluetooth.git
git fetch ca
git checkout ca/jb
cd ../../..

cd frameworks/base
git remote add ca git://codeaurora.org/platform/frameworks/base.git
git fetch ca
git checkout ca/jb
cd ../..

cd system/bluetooth
git remote add ca git://codeaurora.org/platform/system/bluetooth.git
git fetch ca
git checkout ca/jb
cd ../..

Show all branches that contain a commit:

git branch --contains [commit]

Extract folder into different branch with subtree and eliminte project from parent:

git subtree split -d --prefix=[ path ] -m "splitted" -b [ branch ]
git clone -b [ branch ] . temp
git filter-branch --tree-filter 'rm -rf [ path ]' HEAD
git commit -m "eliminated [ path ] from project history"
cd temp
git remote rm origin
git remote add origin
git branch -m [ branch ] master
git push origin master
cd ..
rm -rf temp
git gc --prune=0
git push -f origin master

Eliminate a Commit from branch:
NOTE: make sure the commit referenced by some other branch first, unless you really wanna loose it

git rebase --onto 8c2d4feb4~1 8c2d4feb4 master
git push -f origin master

Advertisements
This entry was posted in Android, AOSP, CodeAurora, git. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s