How to permanently remove files from git and rewrite your git history

Поділитися
Вставка
  • Опубліковано 9 жов 2024

КОМЕНТАРІ • 44

  • @alowe5013
    @alowe5013 Рік тому +1

    I tried 10,000 other solutions, followed guides, all of it...nothing worked until I found this. Thank you so much

  • @alexanderbarrera9906
    @alexanderbarrera9906 3 роки тому +30

    I've been programming professionally for a good 5 years and I've never dealt with a more ridiculous and frustrating situation.

    • @Hozgen
      @Hozgen Рік тому

      extremely idiot situation

  • @AlexanderHelwig-rq1uq
    @AlexanderHelwig-rq1uq 5 місяців тому +2

    Thank you, this has helped me !

  • @glrbrasil
    @glrbrasil Рік тому +1

    I've been stuck at this for a 1 day and a half and solved it thanks to your video. Thanks!

  •  2 роки тому +2

    thnaks!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! git reset --soft HEAD^ saved my life

  • @esdraswite1643
    @esdraswite1643 10 місяців тому +1

    This video helps me alot, i have been stucked at this for two weeks. thank you

  • @raymon4078
    @raymon4078 2 роки тому +1

    great video👍👍it's so helpful

  • @learnflying2101
    @learnflying2101 3 роки тому +1

    Thanks a lot for sharing this useful tool. Spent a few hours on finding the solutions, but not found anything, then I found this video and it worked. So nice. Saved almost 8GB after using this method.

  • @tima467
    @tima467 4 роки тому +1

    Thanks, it was a really great support. The way step by step you have explained was indeed remarkable. I was fighting for this problem for the past 4 days and ultimately today got it done within a few minutes

  • @brian9790
    @brian9790 Рік тому +2

    This is no safe method. The history still remains on the server. Even if it does not show you, it can technically still be found. GitGuardian will tell you. He does not show you in this video...

  • @victorejiofor8115
    @victorejiofor8115 2 роки тому +1

    I am very grateful for your detailed informative explanations you explained everything very clearly.

  • @LeonardLuzon
    @LeonardLuzon 3 роки тому +1

    Got a sensitive file for MongoDB. That was a relief. Thanks!

  • @brkhnzn
    @brkhnzn 2 роки тому +1

    You saved me my guardian. Thank you so much

  • @SpooningTreesap86
    @SpooningTreesap86 3 роки тому +1

    You're a lifesaver, luckily I was using Firebase which according to their docs doesn't really care if you commit the api key info because they have more security rules which reject unauthorized http requests. However still not great because I haven't fully looked into the ins and outs of how they work. Anyways now I have a new key and my repositories history has been purged.

  • @ArturPetrzak
    @ArturPetrzak 3 роки тому +1

    Lifesaver, thank You!

  • @ShahinHemmati2020
    @ShahinHemmati2020 Рік тому

    Exellent tutorial! 👌

  • @maxinitin
    @maxinitin Рік тому

    Great video. Will this works for merge request too? The issue we’re running into is that GitLab merge requests are read-only and therefore can’t be updated, so the push to the merge request refs is rejected, meaning secrets persist in the merge requests.

  • @bikashkarmokar
    @bikashkarmokar 2 роки тому +1

    thanks for such a lovely helpful video.

  • @cambsdigital
    @cambsdigital 13 днів тому

    Handy and thank you. But you need a JDK which on my old mac was not easily possible. Crazy! Git should have something inbuilt to handle this better.

  • @60pluscrazy
    @60pluscrazy 3 роки тому +1

    Perfect 🙏

  • @KrishanChhimpa-l9m
    @KrishanChhimpa-l9m 2 місяці тому

    what about multiple branches, do we need to do it for all the branches ?

  • @matt-g-recovers
    @matt-g-recovers 2 роки тому

    Doing this at scale is pretty scary. What would be a good recommendation for keeping config/environement files? Keep in mind, any one of a couple dozen people , located on the other side of the world to one another. Anyone may need to alter any one of them at any time. 3rd party, this or that?

  • @sujatha7354
    @sujatha7354 Рік тому

    Sir, how to delete hidden files from the research gate?

  • @NemanjaSimovic
    @NemanjaSimovic 3 роки тому

    Great video! You really put an effort to it. Also, helped me a lot! :)

  • @flolu
    @flolu 4 роки тому

    Very useful, thanks!

  • @Tt-wm1ze
    @Tt-wm1ze 3 роки тому

    How do i fix i used git clean -f and it removed filés in my directory as well

  • @tibfox
    @tibfox 2 роки тому

    Thanks!

  • @zaganos7995
    @zaganos7995 3 роки тому

    Amazing! thank you!

  • @basedonprinciple
    @basedonprinciple 3 роки тому

    When you talk about pushing to the remote repo 10:36 you say "all your history will still be there". Are you saying even when pushing with the force flag the remote repo will still have the old commit history?

    • @GitGuardian
      @GitGuardian  3 роки тому

      No when using the force command you are forcing the remote history to match local history. I can see the confusion, what I meant was that if you delete the repository and create a new one you will still maintain history in the new repository (with the edits). Hopefully, this answers your question.

    • @harishsantwani8053
      @harishsantwani8053 2 роки тому

      @@GitGuardian i can still see the history in other branches, even i can see the files that i have deleted.

  • @SpaceTimeBeing_
    @SpaceTimeBeing_ 3 роки тому

    Thank you

  • @sabertoothwallaby2937
    @sabertoothwallaby2937 3 роки тому

    00:06
    oh geez, an intro? This is going to be long and painful

  • @moritzw42
    @moritzw42 4 роки тому +1

    first line of java

  • @Fangh44
    @Fangh44 Рік тому

    The use of BFG is at 8:26

  • @Norfeldt
    @Norfeldt 4 роки тому

    It didn't really work for me. Perhaps you could mention something about 'dirty' content

    • @KennyTutorials
      @KennyTutorials 3 роки тому +1

      After java -jar bfg-1.13.1.jar --delete-files/--delete-folders "file.format' you need to write another command, bfg basically tells about this after command upper. Here it is: 'git reflog expire --expire=now --all && git gc --prune=now --aggressive'. This command basically checks all bfg logs files where it store the data of old commit-hash and new, and call git garbge collector to completle remove files from all commits exept the HEAD. For a local repo this 100% works right away, but for a remote repo it may take time, 1 day maybe. Although if you go to the past commits, then these objects will no longer be there, it will only be noticeable if you try to clone the repo back. And after this operations don't forget to push this changes to remove repo 'git push --force'