Stripping a git repo of all committed files that should have been ignored

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












I recently initiated a git repo and forgot to add a .gitignore file. After my initial commit, my repo has many subdirectories and many files that should have been ignored. Is there an efficient way to add a .gitignore and then push the repo without the files meant to be ignored to a tool like GitLab or GitHub?










share|improve this question























  • Have the files that should be ignored been committed?
    – Stephen Kitt
    16 mins ago










  • Yes. I realized that I was missing my gitignore file after I committed.
    – Brian Fitzpatrick
    14 mins ago














up vote
0
down vote

favorite












I recently initiated a git repo and forgot to add a .gitignore file. After my initial commit, my repo has many subdirectories and many files that should have been ignored. Is there an efficient way to add a .gitignore and then push the repo without the files meant to be ignored to a tool like GitLab or GitHub?










share|improve this question























  • Have the files that should be ignored been committed?
    – Stephen Kitt
    16 mins ago










  • Yes. I realized that I was missing my gitignore file after I committed.
    – Brian Fitzpatrick
    14 mins ago












up vote
0
down vote

favorite









up vote
0
down vote

favorite











I recently initiated a git repo and forgot to add a .gitignore file. After my initial commit, my repo has many subdirectories and many files that should have been ignored. Is there an efficient way to add a .gitignore and then push the repo without the files meant to be ignored to a tool like GitLab or GitHub?










share|improve this question















I recently initiated a git repo and forgot to add a .gitignore file. After my initial commit, my repo has many subdirectories and many files that should have been ignored. Is there an efficient way to add a .gitignore and then push the repo without the files meant to be ignored to a tool like GitLab or GitHub?







git github gitlab






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 10 mins ago

























asked 40 mins ago









Brian Fitzpatrick

7541922




7541922











  • Have the files that should be ignored been committed?
    – Stephen Kitt
    16 mins ago










  • Yes. I realized that I was missing my gitignore file after I committed.
    – Brian Fitzpatrick
    14 mins ago
















  • Have the files that should be ignored been committed?
    – Stephen Kitt
    16 mins ago










  • Yes. I realized that I was missing my gitignore file after I committed.
    – Brian Fitzpatrick
    14 mins ago















Have the files that should be ignored been committed?
– Stephen Kitt
16 mins ago




Have the files that should be ignored been committed?
– Stephen Kitt
16 mins ago












Yes. I realized that I was missing my gitignore file after I committed.
– Brian Fitzpatrick
14 mins ago




Yes. I realized that I was missing my gitignore file after I committed.
– Brian Fitzpatrick
14 mins ago















active

oldest

votes











Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
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',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f478507%2fstripping-a-git-repo-of-all-committed-files-that-should-have-been-ignored%23new-answer', 'question_page');

);

Post as a guest



































active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f478507%2fstripping-a-git-repo-of-all-committed-files-that-should-have-been-ignored%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

Peggy Mitchell

Palaiologos

The Forum (Inglewood, California)