Adding files as if they were added at first time?How to remove local (untracked) files from the current Git working tree?Reset or revert a specific file to a specific revision using Git?View the change history of a file using Git versioningGit workflow and rebase vs merge questionsShowing which files have changed between two revisionsCommit only part of a file in GitHow do I force “git pull” to overwrite local files?How to make Git “forget” about a file that was tracked but is now in .gitignore?ignoring any 'bin' directory on a git projectStash only one file out of multiple files that have changed before git 2.13

Explain why a line can never intersect a plane in exactly two points.

Why does Linux list NVMe drives as /dev/nvme0 instead of /dev/sda?

Print one file per line using echo

macOS: How to take a picture from camera after 1 minute

What is the highest voltage from the power supply a Raspberry Pi 3 B can handle without getting damaged?

How can a warlock learn from a spellbook?

How hard is it to distinguish if I am given remote access to a virtual machine vs a piece of hardware?

Improve appearance of the table in Latex

Are there examples of rowers who also fought?

Should the party get XP for a monster they never attacked?

Why don't countries like Japan just print more money?

Why does independence imply zero correlation?

Is "Busen" just the area between the breasts?

Too early in the morning to have SODA?

Is the specular reflection on a polished gold sphere white or gold in colour?

Do I have to explain the mechanical superiority of the player-character within the fiction of the game?

Justifying Affordable Bespoke Spaceships

A word for delight at someone else's failure?

Syntax and semantics of XDV commands (XeTeX)

Umlaut character order when sorting

Mathematically modelling RC circuit with a linear input

QGIS. Polygon doesn't repeat itself

What is the most suitable position for a bishop here?

How do I remove this inheritance-related code smell?



Adding files as if they were added at first time?


How to remove local (untracked) files from the current Git working tree?Reset or revert a specific file to a specific revision using Git?View the change history of a file using Git versioningGit workflow and rebase vs merge questionsShowing which files have changed between two revisionsCommit only part of a file in GitHow do I force “git pull” to overwrite local files?How to make Git “forget” about a file that was tracked but is now in .gitignore?ignoring any 'bin' directory on a git projectStash only one file out of multiple files that have changed before git 2.13






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








1















I'm facing a situation which should not have happened had I did it correctly at first place.



Anyway , I've created a master branch which contains a root commit.

Then I've created many branches that were created from that master master branch.



enter image description here



So each branch in here ^ was created by :



  • checkout master

  • create a branch

All folders are in the same root folder(file system).



But now I see that I've forgotten the .gitignore file.



I've added it to the master branch.

But apparently it only holds to the master branch. If I checkout another branch , I still see the -should-be-ignored files.

But apparently it doesn't work since the checkout branch doesn't have the .gitignore file



Which makes me walk through manually at every branch and add the .gitignore file.



Question



Since all branches were created from master , Is there any way to add the .gitignore file to the master branch and cause the other branches to "re-inherit" master's files again ?



(so that every branch will have the .gitignore files , as if it was there at first place ?










share|improve this question






















  • .gitignore logic is not dependent on branches, but on the repo config itself. Branches should share this setting... have you tested the same file from different branches with git check-ignore -v <path>? (Also be sure to execute both parts of the test from the same directory, not to introduce other differences.)

    – RomainValeri
    Mar 25 at 8:26











  • @RomainValeri How should it suppose to work ? There was no gitignore file at the beginning. Then I've created many branches. and on each branch i've created projects. many of the files were unnecessary to be added to the git. so i've added a gitignore file , and then i commited it to the master branch. but when I've swapped to another branch , that gitignore isn't exists , and then I saw many unnecessary files.

    – Royi Namir
    Mar 25 at 8:54

















1















I'm facing a situation which should not have happened had I did it correctly at first place.



Anyway , I've created a master branch which contains a root commit.

Then I've created many branches that were created from that master master branch.



enter image description here



So each branch in here ^ was created by :



  • checkout master

  • create a branch

All folders are in the same root folder(file system).



But now I see that I've forgotten the .gitignore file.



I've added it to the master branch.

But apparently it only holds to the master branch. If I checkout another branch , I still see the -should-be-ignored files.

But apparently it doesn't work since the checkout branch doesn't have the .gitignore file



Which makes me walk through manually at every branch and add the .gitignore file.



Question



Since all branches were created from master , Is there any way to add the .gitignore file to the master branch and cause the other branches to "re-inherit" master's files again ?



(so that every branch will have the .gitignore files , as if it was there at first place ?










share|improve this question






















  • .gitignore logic is not dependent on branches, but on the repo config itself. Branches should share this setting... have you tested the same file from different branches with git check-ignore -v <path>? (Also be sure to execute both parts of the test from the same directory, not to introduce other differences.)

    – RomainValeri
    Mar 25 at 8:26











  • @RomainValeri How should it suppose to work ? There was no gitignore file at the beginning. Then I've created many branches. and on each branch i've created projects. many of the files were unnecessary to be added to the git. so i've added a gitignore file , and then i commited it to the master branch. but when I've swapped to another branch , that gitignore isn't exists , and then I saw many unnecessary files.

    – Royi Namir
    Mar 25 at 8:54













1












1








1








I'm facing a situation which should not have happened had I did it correctly at first place.



Anyway , I've created a master branch which contains a root commit.

Then I've created many branches that were created from that master master branch.



enter image description here



So each branch in here ^ was created by :



  • checkout master

  • create a branch

All folders are in the same root folder(file system).



But now I see that I've forgotten the .gitignore file.



I've added it to the master branch.

But apparently it only holds to the master branch. If I checkout another branch , I still see the -should-be-ignored files.

But apparently it doesn't work since the checkout branch doesn't have the .gitignore file



Which makes me walk through manually at every branch and add the .gitignore file.



Question



Since all branches were created from master , Is there any way to add the .gitignore file to the master branch and cause the other branches to "re-inherit" master's files again ?



(so that every branch will have the .gitignore files , as if it was there at first place ?










share|improve this question














I'm facing a situation which should not have happened had I did it correctly at first place.



Anyway , I've created a master branch which contains a root commit.

Then I've created many branches that were created from that master master branch.



enter image description here



So each branch in here ^ was created by :



  • checkout master

  • create a branch

All folders are in the same root folder(file system).



But now I see that I've forgotten the .gitignore file.



I've added it to the master branch.

But apparently it only holds to the master branch. If I checkout another branch , I still see the -should-be-ignored files.

But apparently it doesn't work since the checkout branch doesn't have the .gitignore file



Which makes me walk through manually at every branch and add the .gitignore file.



Question



Since all branches were created from master , Is there any way to add the .gitignore file to the master branch and cause the other branches to "re-inherit" master's files again ?



(so that every branch will have the .gitignore files , as if it was there at first place ?







git






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 25 at 6:58









Royi NamirRoyi Namir

78.2k104343613




78.2k104343613












  • .gitignore logic is not dependent on branches, but on the repo config itself. Branches should share this setting... have you tested the same file from different branches with git check-ignore -v <path>? (Also be sure to execute both parts of the test from the same directory, not to introduce other differences.)

    – RomainValeri
    Mar 25 at 8:26











  • @RomainValeri How should it suppose to work ? There was no gitignore file at the beginning. Then I've created many branches. and on each branch i've created projects. many of the files were unnecessary to be added to the git. so i've added a gitignore file , and then i commited it to the master branch. but when I've swapped to another branch , that gitignore isn't exists , and then I saw many unnecessary files.

    – Royi Namir
    Mar 25 at 8:54

















  • .gitignore logic is not dependent on branches, but on the repo config itself. Branches should share this setting... have you tested the same file from different branches with git check-ignore -v <path>? (Also be sure to execute both parts of the test from the same directory, not to introduce other differences.)

    – RomainValeri
    Mar 25 at 8:26











  • @RomainValeri How should it suppose to work ? There was no gitignore file at the beginning. Then I've created many branches. and on each branch i've created projects. many of the files were unnecessary to be added to the git. so i've added a gitignore file , and then i commited it to the master branch. but when I've swapped to another branch , that gitignore isn't exists , and then I saw many unnecessary files.

    – Royi Namir
    Mar 25 at 8:54
















.gitignore logic is not dependent on branches, but on the repo config itself. Branches should share this setting... have you tested the same file from different branches with git check-ignore -v <path>? (Also be sure to execute both parts of the test from the same directory, not to introduce other differences.)

– RomainValeri
Mar 25 at 8:26





.gitignore logic is not dependent on branches, but on the repo config itself. Branches should share this setting... have you tested the same file from different branches with git check-ignore -v <path>? (Also be sure to execute both parts of the test from the same directory, not to introduce other differences.)

– RomainValeri
Mar 25 at 8:26













@RomainValeri How should it suppose to work ? There was no gitignore file at the beginning. Then I've created many branches. and on each branch i've created projects. many of the files were unnecessary to be added to the git. so i've added a gitignore file , and then i commited it to the master branch. but when I've swapped to another branch , that gitignore isn't exists , and then I saw many unnecessary files.

– Royi Namir
Mar 25 at 8:54





@RomainValeri How should it suppose to work ? There was no gitignore file at the beginning. Then I've created many branches. and on each branch i've created projects. many of the files were unnecessary to be added to the git. so i've added a gitignore file , and then i commited it to the master branch. but when I've swapped to another branch , that gitignore isn't exists , and then I saw many unnecessary files.

– Royi Namir
Mar 25 at 8:54












1 Answer
1






active

oldest

votes


















1














Ok this is clearer now from your comment.




There was no gitignore file at the beginning. Then I've created many branches. and on each branch i've created projects. many of the files were unnecessary to be added to the git. so i've added a gitignore file , and then i commited it to the master branch. but when I've swapped to another branch , that gitignore isn't exists , and then I saw many unnecessary files.




Your .gitignore isn't taken into account on your branches, because you created it on master and did not merge this addition in the branches themselves. So when you switch to another branch, you don't have a .gitignore any more.



Either merge master into your branches (I guess it won't be very convenient in some cases) or just cherry-pick the relevant commit everywhere, but you effectively need your branches to have the .gitignore present to be active.






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55332624%2fadding-files-as-if-they-were-added-at-first-time%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    Ok this is clearer now from your comment.




    There was no gitignore file at the beginning. Then I've created many branches. and on each branch i've created projects. many of the files were unnecessary to be added to the git. so i've added a gitignore file , and then i commited it to the master branch. but when I've swapped to another branch , that gitignore isn't exists , and then I saw many unnecessary files.




    Your .gitignore isn't taken into account on your branches, because you created it on master and did not merge this addition in the branches themselves. So when you switch to another branch, you don't have a .gitignore any more.



    Either merge master into your branches (I guess it won't be very convenient in some cases) or just cherry-pick the relevant commit everywhere, but you effectively need your branches to have the .gitignore present to be active.






    share|improve this answer



























      1














      Ok this is clearer now from your comment.




      There was no gitignore file at the beginning. Then I've created many branches. and on each branch i've created projects. many of the files were unnecessary to be added to the git. so i've added a gitignore file , and then i commited it to the master branch. but when I've swapped to another branch , that gitignore isn't exists , and then I saw many unnecessary files.




      Your .gitignore isn't taken into account on your branches, because you created it on master and did not merge this addition in the branches themselves. So when you switch to another branch, you don't have a .gitignore any more.



      Either merge master into your branches (I guess it won't be very convenient in some cases) or just cherry-pick the relevant commit everywhere, but you effectively need your branches to have the .gitignore present to be active.






      share|improve this answer

























        1












        1








        1







        Ok this is clearer now from your comment.




        There was no gitignore file at the beginning. Then I've created many branches. and on each branch i've created projects. many of the files were unnecessary to be added to the git. so i've added a gitignore file , and then i commited it to the master branch. but when I've swapped to another branch , that gitignore isn't exists , and then I saw many unnecessary files.




        Your .gitignore isn't taken into account on your branches, because you created it on master and did not merge this addition in the branches themselves. So when you switch to another branch, you don't have a .gitignore any more.



        Either merge master into your branches (I guess it won't be very convenient in some cases) or just cherry-pick the relevant commit everywhere, but you effectively need your branches to have the .gitignore present to be active.






        share|improve this answer













        Ok this is clearer now from your comment.




        There was no gitignore file at the beginning. Then I've created many branches. and on each branch i've created projects. many of the files were unnecessary to be added to the git. so i've added a gitignore file , and then i commited it to the master branch. but when I've swapped to another branch , that gitignore isn't exists , and then I saw many unnecessary files.




        Your .gitignore isn't taken into account on your branches, because you created it on master and did not merge this addition in the branches themselves. So when you switch to another branch, you don't have a .gitignore any more.



        Either merge master into your branches (I guess it won't be very convenient in some cases) or just cherry-pick the relevant commit everywhere, but you effectively need your branches to have the .gitignore present to be active.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 25 at 9:00









        RomainValeriRomainValeri

        7,17321435




        7,17321435





























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55332624%2fadding-files-as-if-they-were-added-at-first-time%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

            SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

            은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현