remove git staged modified file with shell one-liner

Pocket

modified はステージから除外したい。

➜  musics git:(master) ✗ git add -u
➜  musics git:(master) ✗ git status
On branch master
Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

    deleted:    iTunes/Album Artwork/Cache/862BD4A2E735FAE2/02/09/02/862BD4A2E735FAE2-300DB04083DAD292.itc2
    deleted:    iTunes/Album Artwork/Cache/862BD4A2E735FAE2/02/09/10/862BD4A2E735FAE2-D7041E0E3AB5BA92.itc2
(snip)
    deleted:    iTunes/Album Artwork/Generated/862BD4A2E735FAE2/13/14/01/862BD4A2E735FAE2-FD2DE971CEE541ED.itc
    deleted:    iTunes/Album Artwork/Generated/862BD4A2E735FAE2/14/00/02/862BD4A2E735FAE2-4738B76C7A69820E.itc
    modified:   iTunes/iTunes Library Extras.itdb
    modified:   iTunes/iTunes Library.itl
    deleted:    iTunes/iTunes Media/Music/9nine/White Wishes/03 チクタク☆2NITE (tofubeats remix).m4a
    deleted:    iTunes/iTunes Media/Music/AA-CHINO/逮捕しちゃうぞフルスロットル OPテーマ「マイティー・バディ」 - Single/01 マイティー・バディ.m4p
    deleted:    iTunes/iTunes Media/Music/AKINO from bless4/海色 - Single/01 海色.m4a
    deleted:    iTunes/iTunes Media/Music/Annabel/シグナルグラフ - Single/01 シグナルグラフ 1.m4a
    deleted:    iTunes/iTunes Media/Music/CHEMISTRY/ALL THE BEST/01 PIECES OF A DREAM.m4a
    deleted:    iTunes/iTunes Media/Music/Ceui/mellow melody - Single/01 mellow melody.m4p
    deleted:    iTunes/iTunes Media/Music/ChouCho/優しさの理由 - Single/01 優しさの理由.m4a
    deleted:    iTunes/iTunes Media/Music/ClariS/ナイショの話 - EP/01 ナイショの話 1.m4a
    deleted:    iTunes/iTunes Media/Music/ClariS/ナイショの話 - EP/01 ナイショの話 2.m4a
    deleted:    iTunes/iTunes Media/Music/ClariS/ナイショの話 - EP/01 ナイショの話.m4a
    deleted:    iTunes/iTunes Media/Music/Compilations/BAMBOO BEAT _ STAR RISE (テレビ東京系アニメーション バンブーブレード Opening _ Ending Theme)  - Single/01 BAMBOO BEAT.m4p
    deleted:    iTunes/iTunes Media/Music/Compilations/DARKNESS NIGHTBRIGHTEST LIGHT - EP/01 DARKNESS NIGHT.m4a
    deleted:    iTunes/iTunes Media/Music/Compilations/DARKNESS NIGHTBRIGHTEST LIGHT - EP/02 BRIGHTEST LIGHT.m4a
    deleted:    iTunes/iTunes Media/Music/Compilations/JAPAN ANIMESONG COLLECTION VOL.8 [アニソン・ジャパン]/20 瞳の中の迷宮 (ヤミと帽子と本の旅人) 1.m4a
    deleted:    iTunes/iTunes Media/Music/Compilations/NEON GENESIS EVANGELION/01 残酷な天使のテーゼ (Director's Edit. Version) 1.m4p
    deleted:    iTunes/iTunes Media/Music/Compilations/NEON GENESIS EVANGELION/02 FLY ME TO THE MOON.m4p
    deleted:    iTunes/iTunes Media/Music/Compilations/NEON GENESIS EVANGELION/04 Rei I.m4p
    deleted:    iTunes/iTunes Media/Music/Compilations/NEON GENESIS EVANGELION/05 Hedgehog's Dilemma.m4p
    deleted:    iTunes/iTunes Media/Music/Compilations/NEON GENESIS EVANGELION/06 BAREFOOT IN THE PARK.m4p
    deleted:    iTunes/iTunes Media/Music/Compilations/NEON GENESIS EVANGELION/07 RITSUKO.m4p
    deleted:    iTunes/iTunes Media/Music/Compilations/NEON GENESIS EVANGELION/08 MISATO.m4p
    deleted:    iTunes/iTunes Media/Music/Compilations/NEON GENESIS EVANGELION/10 NERV.m4p
    deleted:    iTunes/iTunes Media/Music/Compilations/NEON GENESIS EVANGELION/11 TOKYO-3.m4p
    deleted:    iTunes/iTunes Media/Music/Compilations/NEON GENESIS EVANGELION/16 DECISIVE BATTLE.m4p
    deleted:    iTunes/iTunes Media/Music/Compilations/NEON GENESIS EVANGELION/19 MARKING TIME, WAITING FOR DEATH.m4p
    deleted:    iTunes/iTunes Media/Music/Compilations/NEON GENESIS EVANGELION/20 Rei II 1.m4p
    deleted:    iTunes/iTunes Media/Music/Compilations/NEON GENESIS EVANGELION/20 Rei II.m4p
    deleted:    iTunes/iTunes Media/Music/Compilations/NEON GENESIS EVANGELION/21 FLY ME TO THE MOON (instrumental).m4p
    deleted:    iTunes/iTunes Media/Music/Compilations/NEON GENESIS EVANGELION/22 次回予告.m4p
    deleted:    iTunes/iTunes Media/Music/Compilations/NEON GENESIS EVANGELION/23 FLY ME TO THE MOON (YOKO TAKAHASHI Acid Bossa Version).m4p
    deleted:    iTunes/iTunes Media/Music/Compilations/Songs for Young & Silly Age/01 マイペース大王 1.m4a
    deleted:    iTunes/iTunes Media/Music/Compilations/Songs for Young & Silly Age/01 マイペース大王.m4a
    deleted:    iTunes/iTunes Media/Music/Compilations/THE END OF EVANGELION (Original Soundtrack)/05 身代わりの侵入 1.m4p
    deleted:    iTunes/iTunes Media/Music/Compilations/THE END OF EVANGELION (Original Soundtrack)/12 Jesus bleibet meine Freude [Herz und Mund und Tat und Leben BWV.147] _主よ、人の望みの喜びよ 1.m4p
    deleted:    iTunes/iTunes Media/Music/Compilations/TVアニメ 中二病でも恋がしたい ボーカルミニアルバム 暗黒虹彩楽典/03 でいなばよって☆マサリモ.m4a
    deleted:    iTunes/iTunes Media/Music/Compilations/TVアニメ「あっちこっち」キャラクターソングミニアルバム ~お悩みゅーじっく・たーみなる~/02 スウィートハッピー 3.m4a
    deleted:    iTunes/iTunes Media/Music/Compilations/TVアニメ「あっちこっち」キャラクターソングミニアルバム ~お悩みゅーじっく・たーみなる~/02 スウィートハッピー 4.m4a
    deleted:    iTunes/iTunes Media/Music/Compilations/TVアニメ「あっちこっち」キャラクターソングミニアルバム ~お悩みゅーじっく・たーみなる~/02 スウィートハッピー.m4a
    deleted:    iTunes/iTunes Media/Music/Compilations/TVアニメ「アマガミSS」キャラクターイメージソングス For You・・・/01 Wonderful Days.m4p
    deleted:    iTunes/iTunes Media/Music/Compilations/TVアニメ「アマガミSS」キャラクターイメージソングス For You・・・/03 Love Scene.m4p
(snip)
➜  musics git:(master) ✗ git status | fgrep modifi | cut -d: -f2
   iTunes/iTunes Library Extras.itdb
   iTunes/iTunes Library.itl
   iTunes/iTunes Media/Music/いきものがかり/FUN! FUN! FANFARE!/09 ジャンプ!.m4a
   iTunes/iTunes Music Library.xml
   iTunes/iTunes Media/Music/Larval Stage Planning/Stargazer - Single/01 Stargazer.m4a
➜  musics git:(master) ✗ git status | fgrep modifi | cut -d: -f2 | tr -d " "
iTunes/iTunesLibraryExtras.itdb
iTunes/iTunesLibrary.itl
iTunes/iTunesMedia/Music/いきものがかり/FUN!FUN!FANFARE!/09ジャンプ!.m4a
iTunes/iTunesMusicLibrary.xml
iTunes/iTunesMedia/Music/LarvalStagePlanning/Stargazer-Single/01Stargazer.m4a
➜  musics git:(master) ✗ git status | fgrep modifi | cut -d: -f2 | sed -e "s/^ +//g" | sed -e "s/ +$//g" | xargs -I{} git reset "{}"
Unstaged changes after reset:
M   iTunes/iTunes Library Extras.itdb
M   iTunes/iTunes Media/Music/Larval Stage Planning/Stargazer - Single/01 Stargazer.m4a
Unstaged changes after reset:
M   iTunes/iTunes Library Extras.itdb
M   iTunes/iTunes Library.itl
M   iTunes/iTunes Media/Music/Larval Stage Planning/Stargazer - Single/01 Stargazer.m4a
Unstaged changes after reset:
M   iTunes/iTunes Library Extras.itdb
M   iTunes/iTunes Library.itl
M   iTunes/iTunes Media/Music/Larval Stage Planning/Stargazer - Single/01 Stargazer.m4a
M   iTunes/iTunes Media/Music/いきものがかり/FUN! FUN! FANFARE!/09 ジャンプ!.m4a
Unstaged changes after reset:
M   iTunes/iTunes Library Extras.itdb
M   iTunes/iTunes Library.itl
M   iTunes/iTunes Media/Music/Larval Stage Planning/Stargazer - Single/01 Stargazer.m4a
M   iTunes/iTunes Media/Music/いきものがかり/FUN! FUN! FANFARE!/09 ジャンプ!.m4a
M   iTunes/iTunes Music Library.xml
Unstaged changes after reset:
M   iTunes/iTunes Library Extras.itdb
M   iTunes/iTunes Library.itl
M   iTunes/iTunes Media/Music/Larval Stage Planning/Stargazer - Single/01 Stargazer.m4a
M   iTunes/iTunes Media/Music/いきものがかり/FUN! FUN! FANFARE!/09 ジャンプ!.m4a
M   iTunes/iTunes Music Library.xml

Sponsored Link

Leave a Reply

Your email address will not be published. Required fields are marked *