0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

git rebase 使いたい案件に初めて遭遇した

Posted at

背景

  • 結構前にcommitしてしまったものにデカイファイルがあった
  • commitをかなりした後にリモートにpushしようとしたら「デカイファイルがあるのでremote rejectしました」エラーが出た
  • git rm そのファイル をしてcommitしても、一度commitされてるファイルなので、pushしようとする
  • 最初にcommitした時点に戻って、ファイルを取り除かないといけない!
$ git push -u origin local-staging-darkorange
Enumerating objects: 149, done.
Counting objects: 100% (149/149), done.
Delta compression using up to 8 threads.
Compressing objects: 100% (114/114), done.
Writing objects: 100% (114/114), 115.08 MiB | 1.85 MiB/s, done.
Total 114 (delta 81), reused 0 (delta 0)
remote: Resolving deltas: 100% (81/81), completed with 29 local objects.
remote: warning: File sheets-export.zip is 55.36 MB; this is larger than GitHub's recommended maximum file size of 50.00 MB
remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com.
remote: error: Trace: 501288f695fd5ee39c76eee83cda62a8
remote: error: See http://git.io/iEPt8g for more information.
remote: error: File wnjpn.db is 193.70 MB; this exceeds GitHub's file size limit of 100.00 MB
To https://github.com/***
 ! [remote rejected]   local-staging-darkorange -> local-staging-darkorange (pre-receive hook declined)
error: failed to push some refs to 'https://github.com/***'

したこと

$ git log -p wnjpn.db
commit 239b04ceb8b988a900af5100734c07314ca1d44a
Date:   Fri May 17 11:52:12 2019 +0900
    ボタン変更など

$ git log --oneline
4492c9c4 (HEAD -> local-staging-darkorange) modify
bab5be53 *** テストスクリプト作成
a4e50bd1 項目数に制限がない項目を同等に扱う
9afb0a4c rule_form_element.csv変更
ecefa5ac trush iconの表示方法の変更
d2bcc121 *** テストスクリプト
239b04ce ボタン変更など

$ git rebase -i HEAD~7
Checking out files: 100% (20/20), done.
Stopped at 239b04ce...  ボタン変更など
You can amend the commit now, with
  git commit --amend 
Once you are satisfied with your changes, run
  git rebase --continue

$ git rm --cached wnjpn.db
rm 'wnjpn.db'
$ git commit --amend
$ git rebase --continue
Successfully rebased and updated refs/heads/local-staging-darkorange.

参考

http://shuzo-kino.hateblo.jp/entry/2014/05/22/222251
https://chaika.hatenablog.com/entry/2016/03/22/181243
https://qiita.com/megu_ma/items/a438a71c84145f14d04e

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?