Trying to ignore .pyc extension in .gitignore [duplicate]
This question already has an answer here:
How to make Git “forget” about a file that was tracked but is now in .gitignore?
21 answers
I am trying to ignore all .pyc extensions in the repository
my .gitignore file looks like this
.idea
*.rdb
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*.pyc
__pycache__/
however when I do git status
. I get information on modified files like this
On branch master
Your branch is up-to-date with 'origin/master'.
Changes not staged for commit:
(use "git add/rm <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: .DS_Store
modified: .gitignore
modified: Device/__init__.py
modified: Device/admin.py
modified: Device/apps.py
modified: Device/migrations/0001_initial.py
modified: Device/migrations/__init__.py
modified: Employee/__init__.py
modified: Employee/__pycache__/__init__.cpython-35.pyc
Notice the last file .pyc is shown as modified and also the foled pycache which is added to .gitignore also gets shown. How do I get git to ignore them ?
git
marked as duplicate by Edward Thomson
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 27 '18 at 10:41
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |
This question already has an answer here:
How to make Git “forget” about a file that was tracked but is now in .gitignore?
21 answers
I am trying to ignore all .pyc extensions in the repository
my .gitignore file looks like this
.idea
*.rdb
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*.pyc
__pycache__/
however when I do git status
. I get information on modified files like this
On branch master
Your branch is up-to-date with 'origin/master'.
Changes not staged for commit:
(use "git add/rm <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: .DS_Store
modified: .gitignore
modified: Device/__init__.py
modified: Device/admin.py
modified: Device/apps.py
modified: Device/migrations/0001_initial.py
modified: Device/migrations/__init__.py
modified: Employee/__init__.py
modified: Employee/__pycache__/__init__.cpython-35.pyc
Notice the last file .pyc is shown as modified and also the foled pycache which is added to .gitignore also gets shown. How do I get git to ignore them ?
git
marked as duplicate by Edward Thomson
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 27 '18 at 10:41
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
1
Those files are already in your repository, and are currently tracked (i.e., in your index). Listing them in.gitignore
has no effect. You must make them untracked: see stackoverflow.com/questions/936249/…
– torek
Nov 27 '18 at 9:11
add a comment |
This question already has an answer here:
How to make Git “forget” about a file that was tracked but is now in .gitignore?
21 answers
I am trying to ignore all .pyc extensions in the repository
my .gitignore file looks like this
.idea
*.rdb
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*.pyc
__pycache__/
however when I do git status
. I get information on modified files like this
On branch master
Your branch is up-to-date with 'origin/master'.
Changes not staged for commit:
(use "git add/rm <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: .DS_Store
modified: .gitignore
modified: Device/__init__.py
modified: Device/admin.py
modified: Device/apps.py
modified: Device/migrations/0001_initial.py
modified: Device/migrations/__init__.py
modified: Employee/__init__.py
modified: Employee/__pycache__/__init__.cpython-35.pyc
Notice the last file .pyc is shown as modified and also the foled pycache which is added to .gitignore also gets shown. How do I get git to ignore them ?
git
This question already has an answer here:
How to make Git “forget” about a file that was tracked but is now in .gitignore?
21 answers
I am trying to ignore all .pyc extensions in the repository
my .gitignore file looks like this
.idea
*.rdb
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*.pyc
__pycache__/
however when I do git status
. I get information on modified files like this
On branch master
Your branch is up-to-date with 'origin/master'.
Changes not staged for commit:
(use "git add/rm <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: .DS_Store
modified: .gitignore
modified: Device/__init__.py
modified: Device/admin.py
modified: Device/apps.py
modified: Device/migrations/0001_initial.py
modified: Device/migrations/__init__.py
modified: Employee/__init__.py
modified: Employee/__pycache__/__init__.cpython-35.pyc
Notice the last file .pyc is shown as modified and also the foled pycache which is added to .gitignore also gets shown. How do I get git to ignore them ?
This question already has an answer here:
How to make Git “forget” about a file that was tracked but is now in .gitignore?
21 answers
git
git
edited Nov 27 '18 at 9:13
torek
193k18239321
193k18239321
asked Nov 27 '18 at 9:06
MistyDMistyD
4,1891472141
4,1891472141
marked as duplicate by Edward Thomson
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 27 '18 at 10:41
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
marked as duplicate by Edward Thomson
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 27 '18 at 10:41
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
1
Those files are already in your repository, and are currently tracked (i.e., in your index). Listing them in.gitignore
has no effect. You must make them untracked: see stackoverflow.com/questions/936249/…
– torek
Nov 27 '18 at 9:11
add a comment |
1
Those files are already in your repository, and are currently tracked (i.e., in your index). Listing them in.gitignore
has no effect. You must make them untracked: see stackoverflow.com/questions/936249/…
– torek
Nov 27 '18 at 9:11
1
1
Those files are already in your repository, and are currently tracked (i.e., in your index). Listing them in
.gitignore
has no effect. You must make them untracked: see stackoverflow.com/questions/936249/…– torek
Nov 27 '18 at 9:11
Those files are already in your repository, and are currently tracked (i.e., in your index). Listing them in
.gitignore
has no effect. You must make them untracked: see stackoverflow.com/questions/936249/…– torek
Nov 27 '18 at 9:11
add a comment |
1 Answer
1
active
oldest
votes
It seems like your .pyc
file was added before you commited the .gitignore
.
Try to first remove everything that is tracked by:
git rm -r --cached .
OR:
git rm -r --cached Employee/__pycache__/__init__.cpython-35.pyc
Now, try:
git add .
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
It seems like your .pyc
file was added before you commited the .gitignore
.
Try to first remove everything that is tracked by:
git rm -r --cached .
OR:
git rm -r --cached Employee/__pycache__/__init__.cpython-35.pyc
Now, try:
git add .
add a comment |
It seems like your .pyc
file was added before you commited the .gitignore
.
Try to first remove everything that is tracked by:
git rm -r --cached .
OR:
git rm -r --cached Employee/__pycache__/__init__.cpython-35.pyc
Now, try:
git add .
add a comment |
It seems like your .pyc
file was added before you commited the .gitignore
.
Try to first remove everything that is tracked by:
git rm -r --cached .
OR:
git rm -r --cached Employee/__pycache__/__init__.cpython-35.pyc
Now, try:
git add .
It seems like your .pyc
file was added before you commited the .gitignore
.
Try to first remove everything that is tracked by:
git rm -r --cached .
OR:
git rm -r --cached Employee/__pycache__/__init__.cpython-35.pyc
Now, try:
git add .
answered Nov 27 '18 at 10:31
Mr.TurtleMr.Turtle
1,10821226
1,10821226
add a comment |
add a comment |
1
Those files are already in your repository, and are currently tracked (i.e., in your index). Listing them in
.gitignore
has no effect. You must make them untracked: see stackoverflow.com/questions/936249/…– torek
Nov 27 '18 at 9:11