Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Matt,</p> <p>Have you pushed your repo yet and has anyone consumed it? If not... more importantly if your history is still your own then you need to <strong>rebase</strong> to rewrite your history. Let's say I have a repo for example with the following simple history:</p> <pre><code>$ git log --summary --stat 001d888 Yet some more work (Fred - 71 seconds ago) file2.txt | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) 3f74e79 Doing some more work (Fred - 2 minutes ago) file1.txt | 1 + file3.txt | 1 + 2 files changed, 2 insertions(+), 0 deletions(-) 8acc3d8 Adding some more files (Fred - 3 minutes ago) 0 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 file1.txt create mode 100644 file2.txt create mode 100644 file3.txt fb3a2e1 Just added a big ole file (Fred - 4 minutes ago) BigOleFile.blob | Bin 0 -&gt; 33214460 bytes 1 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 BigOleFile.blob 6d0ab2b first commit (Fred - 8 minutes ago) 0 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 README </code></pre> <p>Imagine that the BigOleFile.blob is your big file... </p> <p>To rewrite the history get the sha of the commit right before the one you want to remove. In this case it's:</p> <p><code>6d0ab2b</code></p> <p>And if your git log is crazy big do something like the following to filter it down and still give you context around the match: </p> <pre><code>git log --summary --stat | grep avi --context=10 </code></pre> <p>Now <strong>rebase</strong> your history using the interactive option. </p> <pre><code>$ git rebase --interactive 6d0ab2b </code></pre> <p>You'll get something like so:</p> <pre><code>pick fb3a2e1 Just added a big ole file pick 8acc3d8 Adding some more files pick 3f74e79 Doing some more work pick 001d888 Yet some more work # Rebase 6d0ab2b..001d888 onto 6d0ab2b # # Commands: # p, pick = use commit # r, reword = use commit, but edit the commit message # e, edit = use commit, but stop for amending # s, squash = use commit, but meld into previous commit # f, fixup = like "squash", but discard this commit's log message # x &lt;cmd&gt;, exec &lt;cmd&gt; = Run a shell command &lt;cmd&gt;, and stop if it fails # # If you remove a line here THAT COMMIT WILL BE LOST. # However, if you remove everything, the rebase will be aborted. # </code></pre> <p>Delete the line having the sha where the file was added... In this case it's the first line. You will have to most likely go through several prompts afterwards during the rebasing session, but it might be fairly clean and you'll get away with it. After your done you will get the message:</p> <pre><code>Successfully rebased and updated refs/heads/master. </code></pre> <p>Looking at the git log again to make sure:</p> <pre><code>$ git log --summary --shortstat 7c499bb Yet some more work (Fred - 12 minutes ago) 1 files changed, 1 insertions(+), 0 deletions(-) 4dfa303 Doing some more work (Fred - 13 minutes ago) 2 files changed, 2 insertions(+), 0 deletions(-) 2f27c1b Adding some more files (Fred - 14 minutes ago) 0 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 file1.txt create mode 100644 file2.txt create mode 100644 file3.txt 6d0ab2b first commit (Fred - 19 minutes ago) 0 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 README </code></pre> <p>Pushing to master afterwards:</p> <pre><code>$ git push origin master Counting objects: 9, done. Delta compression using up to 2 threads. Compressing objects: 100% (6/6), done. Writing objects: 100% (8/8), 751 bytes, done. Total 8 (delta 2), reused 0 (delta 0) To git@github.com:xxxxxxxxxxx/temp.git 6d0ab2b..7c499bb master -&gt; master </code></pre> <p>As you can see ... file all gone bye - bye. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload