List all commits from history, and choose the required commit.
[[email protected] kernel]$git log --pretty=oneline 8983d7058d2f6b7ff907328c53fc0e97d5c0f576 ^ 832219061059f8d9af922a54bb935927c5bbedff New b53e4b1de439e031bd50fe9aa4fd84dd51e2e438 Added missing 02086fc547c3ffbba4abf07327bb18cda3dfee0f Missing files d6f61dadd035ef118231b4144ffcc05c6282212b More missing files added ed26cc3c8c4709ad53bd9365394e6f40352f0461 Added files missed by buggy .gitignore rules 5ce7674d493bc1401f6aa45d3e817a839f3a21c5 Added some missing files cd2cebfe9f70c07b00650faa21d28f9d6c50516a .Gitignore changes d5c8c3f188672a5a1f8c8d5c959f0fe280e827c1 Toolchain location change 0ee33d2545676c5f38719ae0b1ccf539d987ac49 Merge branch 'master' of ssh://bitbucket.org/droidzone/kernel_android_n7100_v1 8b34f1deaaa4305ba31388946de098a784efc7d6 Android README info A few more .gitignore files df5f8a17a25a2240ad7baf2651a1df1a366b25b6 Android README info A few more .gitignore files 11aa64f2d0fff0cda4753db88072b0a0f34816f6 Compiler errors: Fixes for the following error: b9202d534b4a342cfd6baf914ddbace25b4c94df Fix for compiler errors: Switched always_inline ea1e1b5cb75bde723fbc033d13546c34f990378b Fix for inlining error during compilation 404c50fe3e735581754c47e0ebb24e7ea1c15902 Compiler fixes? e52b83584f9316422b18b7166fcfdecf218ed715 Disable module versioning c299ec681a2c2c98f649701d7cb612a160421e7b Toolchain customizationsy e260d9fd0c998a545ea8134f9c416f89592c10d8 Makefile changes: Added toolchain customization (NDK) gcc 4.4.3 .config: defconfig + [x] Bzip2, lzma, xz com 5b6dbfb958551a6f0f8bbeb4bb9856ea64afac5c First commit
I want to reset to first commit and clean up the history too (so that it will be as if the commits following from that commit will cease to have ever existed).
[[email protected] kernel]$git reset --hard 5b6dbfb958551a6f0f8bbeb4bb9856ea64afac5c
As you can note, here the SHA of the first commit is entered.
You can confirm that the git has been taken back to first commit:
[[email protected] kernel]$git log commit 5b6dbfb958551a6f0f8bbeb4bb9856ea64afac5c Author: droidzone <[email protected]> Date: Mon Dec 24 23:01:32 2012 +0530 First commit Samsung Galaxy Note2 N7100 -------------------------- - Droidzone www.droidzone.in - Support/Downloads: www.note2.droidzone.in Initial Modifications: [x] Based on Samsung IN Source Drop - GT-N7100_JB_Opensource.zip [x] Added cypress resistive touch button drivers from GT-N7100_HK_JB_Opensource.zip Samsung Source: http://opensource.samsung.com/
Joel G Mathew, known in tech circles by the pseudonym Droidzone, is an opensource and programming enthusiast.
His favorite pastime is grappling with GNU compilers, discovering newer Linux secrets, writing scripts, hacking roms, and programs (nothing illegal), reading, blogging. and testing out the latest gadgets.
When away from the tech world, Dr Joel G. Mathew is a practising ENT Surgeon, busy with surgeries and clinical practise.