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;
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.
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
add a comment |
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.
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
.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 withgit 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
add a comment |
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.
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
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.
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
git
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 withgit 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
add a comment |
.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 withgit 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
add a comment |
1 Answer
1
active
oldest
votes
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.
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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.
add a comment |
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.
add a comment |
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.
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.
answered Mar 25 at 9:00
RomainValeriRomainValeri
7,17321435
7,17321435
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
.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 withgit 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