How to Ignore Git Folders and Directories .gitignore

Поделиться
HTML-код
  • Опубликовано: 4 окт 2021
  • Here's a quick overview of how to use the .gitignore file to ignore Git folders and directories.
    There's no big trick to ignoring folder in Git. Just add the name of the folder with a trailing slash to your .gitignore file. Then, the next time you commit or push with Git, the directory will be ignored and the folder will not be part of the commit.

Комментарии • 60

  • @kayodeolanrewaju1895
    @kayodeolanrewaju1895 Год назад +1

    Your explanation was so concise and easy to understand. Thanks

  • @thepassingpawn
    @thepassingpawn Год назад +4

    such an easy to understand tutorial, Cameron. Thanks much

  • @ethangordon3935
    @ethangordon3935 2 года назад +2

    Amazing explanation my man. Thank you!

    • @cameronmcnz
      @cameronmcnz  2 года назад

      Glad I could help. Lots of Git features that aren't documented too well. Happy to fill in a few gaps for a great tool!

  • @svens3722
    @svens3722 Год назад +3

    thank you for not overcomplicating it and stretch it to 10 mins. thank you a lot. have a great day. you helped me a lot.

  • @nuraybaxsl827
    @nuraybaxsl827 Год назад

    Thank you for easy explanation .It helps me a lot

  • @AnanshGupta
    @AnanshGupta 25 дней назад

    Very precise and informative video , thank you

  • @pratyushvaibhaw6170
    @pratyushvaibhaw6170 11 месяцев назад +1

    Most concise and to the video.

  • @soubiluv98
    @soubiluv98 2 года назад +1

    Thank for the quick easy tutorial!

    • @cameronmcnz
      @cameronmcnz  2 года назад

      Glad I could be of assistance. Happy Git!

  • @rehamalbulushi520
    @rehamalbulushi520 2 года назад +1

    Thanks for such a quick useful tutorial ;)

    • @cameronmcnz
      @cameronmcnz  2 года назад

      Glad I could help. Trying to keep my tutorials quick and to the point!

  • @lester_cch9877
    @lester_cch9877 Год назад

    God bless you man, you saved my job

  • @notjpengineer
    @notjpengineer Год назад

    Amazing content, thank you!

  • @spiralni
    @spiralni 2 года назад

    what about if I dont want to add content from folders inside another folders. e.g folder1/target, folder2/target...?

  • @xXAngelmlXx
    @xXAngelmlXx 2 года назад +3

    I tried this and it's not working for me :(
    When I write: foldername/
    it just wont ignore the folder

  • @bitelogger
    @bitelogger Год назад +1

    Hi Cameron, amazing video maybe the best explanation I have seen about this subject, question how can I make sure this ".gitignore" goes towards any new branch?

    • @cameronmcnz
      @cameronmcnz  Год назад

      It should copy over every time you branch off a piece of code that already has a gitignore.

  • @germanungo9435
    @germanungo9435 Год назад

    Totally worked. Thanks!

  • @S.Saurabh_
    @S.Saurabh_ Год назад

    I want to ignore a particular file within many files inside a folder. I specified the exact location of that file, but still it is not being ignored. What might be the reason.

  • @rohiniraj5692
    @rohiniraj5692 Год назад

    Is that possible to ignore a set of files while raising PR request?

  • @vurkins
    @vurkins Год назад

    Is there a way to ignore any folder but keep files? I don't know what folder name would be created by someone else

  • @TechNestHubOfficial
    @TechNestHubOfficial 7 месяцев назад +2

    excellent and good understanding technique

    • @cameronmcnz
      @cameronmcnz  7 месяцев назад

      Thanks for the kind words! I try and get right to the point.

  • @tony355367
    @tony355367 Год назад

    Thanks !! A lot of teaching did not say to key touch .ignore

  • @marsdwarf
    @marsdwarf 2 года назад +4

    Perfect explanation. Short and Sweet. Thank you!

    • @cameronmcnz
      @cameronmcnz  2 года назад +1

      What about the thumbnail art? I think the thumbnail art is hilarious. :) Thanks so much for the kind words and the encouragement.

    • @marsdwarf
      @marsdwarf 2 года назад +1

      @@cameronmcnz To be honest I was a bit confused with the thumbnail. Maybe it's just me!

  • @Xaffre
    @Xaffre 8 месяцев назад +1

    A little bit of confusion hit me @2:52 when you said "...we don't want that target folder to be added to the git repository...".
    Seconds earlier it was said that we don't want anything "in" that target folder up to the server.
    So with that syntax "target/" does it ignore the folder itself? (as well as the contents)
    Thanks!

    • @cameronmcnz
      @cameronmcnz  8 месяцев назад

      Imma have to go an re-watch that...

  • @filipetrujeira3359
    @filipetrujeira3359 2 года назад

    The only reason nobody was looking at me was because I forgot to take the .gitignore sign off my back! Thank you!

  • @emirhandemir3872
    @emirhandemir3872 2 года назад +1

    I LOVE YOU SO MUCH :)

    • @cameronmcnz
      @cameronmcnz  2 года назад

      LOL! So glad I could help you out!

  • @rorygrignard9742
    @rorygrignard9742 Год назад

    Nice vid

  • @hakami1426
    @hakami1426 Год назад +1

    What if the folder we want to ignore is already added or committed?

    • @cameronmcnz
      @cameronmcnz  Год назад

      I think if it's already in the repo you're out of luck, but I'd have to look at the docs.

  • @fmww702
    @fmww702 Год назад +1

    Thank you!

  • @TrySomeCG
    @TrySomeCG Год назад

    how do i ignore folder inside another folder? but i want to keep the parent folder, for example i have a folder called "Content" and inside content i have another folder called "CustomAssets" i want git to ignore "Custom Assets" but keep "Content" folder, how do i do it?

    • @_origin5858
      @_origin5858 Год назад

      did u find any solution for this ?

    • @TrySomeCG
      @TrySomeCG Год назад

      @@_origin5858 yes, just type Content/"your folder"/*

    • @_origin5858
      @_origin5858 Год назад

      ​@@TrySomeCG you mean Content/Parent_Folder/ Folder_to_Ignore ?

    • @TrySomeCG
      @TrySomeCG Год назад

      @@_origin5858 yes if you have a parent folder that will work but dont forget to add "/*" in the end

  • @larkicode8704
    @larkicode8704 2 года назад +1

    Thanks man!

  • @fotoh1589
    @fotoh1589 Год назад

    Thanks youuuuu

  • @jubaaissaoui5678
    @jubaaissaoui5678 Год назад

    Thanks

  • @Will_of_Iron
    @Will_of_Iron 11 месяцев назад +1

    Thanks.

  • @wicaksonoleksono7327
    @wicaksonoleksono7327 2 месяца назад +1

    im panicking after trying to push 40gb asset storage accidentally, thanks man

    • @cameronmcnz
      @cameronmcnz  2 месяца назад

      Been there, done that. Did GitHub reject the push? Normally it would unless you have a special plan.
      At times like that, what I often do instead of trying to fix your local repo where the big file is inside of it, just do a new clone from GitHub.
      Since GitHub will reject a big file, if you do a new clone you get everything from before your last push, minus a few recent changes.
      If you can just add those changes since the last push without the big files in your repo, you're good.
      Just an easier option than trying to remove things from your git history.

    • @wicaksonoleksono7327
      @wicaksonoleksono7327 2 месяца назад +1

      @@cameronmcnz yeah but in log there is already a commit log, i just reset and rebase haha, but thank god its all fixed

    • @cameronmcnz
      @cameronmcnz  2 месяца назад +1

      @@wicaksonoleksono7327 As long as you recovered. Now stop copying giant files into your git repo!

  • @davidshum1938
    @davidshum1938 2 года назад +1

    thanks

    • @cameronmcnz
      @cameronmcnz  2 года назад

      I'm just going to ignore that comment. :)

  • @ksdnsdkumar1375
    @ksdnsdkumar1375 Год назад

    @1:51 video starts

    • @cameronmcnz
      @cameronmcnz  Год назад

      It's not like it's a long video! I try and keep all my videos fairly short.

  • @lucutes2936
    @lucutes2936 6 месяцев назад +1

    meow

    • @cameronmcnz
      @cameronmcnz  6 месяцев назад

      Is that a good 'meow' or a 'bad meow?'