Skip to main content
Filter by
Sorted by
Tagged with
2 votes
1 answer
109 views

I have a curious case with git clean -X. I want to delete all ignored files in a clone, except the .vs folder (which is ignored but should not be deleted). This works with git clean -Xnd -e !.vs - ...
bers's user avatar
  • 6,309
0 votes
1 answer
299 views

I have internal github in our organization. There is a particular git repo where I need to replace a sensitive string from all commits. There are around 2000 commits and the sensitive string is there ...
Arun Krishnan's user avatar
0 votes
0 answers
19 views

please help me i delete all files on my macbook by command ( git clean -fd  ) i dont know what i do all files had deleted i hope you help me i dont have any idea how to fix it the command ( git ...
Ali Nassar's user avatar
0 votes
0 answers
113 views

Please help me! I just f***ed up everything! I was working on a angular crash course project in visual studio and then wanted to commit my changes to git so i first wanted to add my git repo to the ...
Labi's user avatar
  • 1
3 votes
1 answer
1k views

I have a git repository that contains multiple branch that diverged a lot. When I say diverged it means that each branch can contain new folder or submodule and a lot of diffs between files. When you ...
CyDevos's user avatar
  • 441
0 votes
0 answers
3k views

I have accidentally run git clean -df. It removed my files from my current commit, which I had yet to push. Now, in git status, those files are marked with D, which means "deleted". Is there ...
Lucia's user avatar
  • 1
1 vote
2 answers
110 views

Below code I am trying and the output should contain the branch name with x month ago. Any suggestion in this logic would be greatly appreciated. Here the main aim of the code is to fetch list all ...
rowoc's user avatar
  • 249
0 votes
0 answers
433 views

git clean with the -ffxd option does not clean directories called .git - how can I do this? Using git 2.32.0 mkdir myrepo && cd myrepo git init . mkdir src && cd src touch code.cpp git ...
ezekiel's user avatar
  • 554
1 vote
2 answers
887 views

I have a GIT repository in a ~/foo folder. Now, created a bar/ folder there with some contents, under ~/foo/public/bar/. It is correctly recognized by GIT as untracked: ~/foo git status -s ?? public/...
Robo Robok's user avatar
  • 23.1k
1 vote
3 answers
791 views

If I rename some directories, then commit and push to the origin, and later pull from another computer I will find both the old an new directories. In the old directories there will be some ignored ...
Jonatan Öström's user avatar
1 vote
3 answers
2k views

I am cleaning a git repository's pull requests (PR). There was one PR created to merge a branch B, which was later considered deprecated and removed before being merged. As a result, branch B was ...
Ken S's user avatar
  • 365
4 votes
0 answers
6k views

I accidentaly run: git clean -xdf And deleted all the files I needed locally, how can I revert it?
Mati's user avatar
  • 61
0 votes
1 answer
206 views

I was trying to perform git clean for some untracked files. I typed the following, unintentionally right, command: git clean -dn | grep -v <files_to_exclude> | git clean -df Note that the line ...
joker's user avatar
  • 3,812
-1 votes
3 answers
4k views

I have been trying to get rid of the untracked files showing up when I run git status on my Git Bash terminal. This has also affected my whole computer system as I usually see different files as well ...
Micah Shallom 's user avatar
0 votes
0 answers
1k views

I was so stipud run that command git clean -fdx, and lots of my untracked files had been removed. I searched google again and again for any solutions, but it seems there is no way to get back those ...
jaycelimm's user avatar
0 votes
1 answer
279 views

In my branch A, I created a new directory myDir. I commited all changes on that branch by git add . and commit. I don't see any untracked file or directory. Then I switch to branch B, I see untracked ...
Leem.fin's user avatar
  • 42.9k
-1 votes
1 answer
806 views

We have done shelv in intelljIDEA and after that we performed git clean -f -d -x and we lost all the changes. How to retrieve my lost files.
loneStar's user avatar
  • 4,040
0 votes
2 answers
6k views

I have been having problems with pulling from git to my server for a few days with it saying one file was untracked, after reading github i ran git clean -d -f and its basically removed a whole ton of ...
Gaz Smith's user avatar
  • 1,106
7 votes
3 answers
6k views

Suppose I create (but do not commit) a file file.txt, and then type git checkout HEAD or git checkout HEAD .. I thought git checkout basically overwrote your current working files with the snapshot at ...
Jack M's user avatar
  • 6,494
27 votes
7 answers
30k views

I'm getting the "The following untracked working tree files would be overwritten by checkout...please move or remove them before you switch branches" error. The common fix appears to be git clean ...
DA.'s user avatar
  • 40.8k
2 votes
2 answers
384 views

I'm working with a repository where you often want to do a clean build. This causes the build script to issue a git clean -Xdff which will remove all files that match patterns in .gitignore. I want ...
turbulencetoo's user avatar
0 votes
1 answer
794 views

I just cleaned a file while exploring cleaning option in git. How can i get that file back ? I used below command: git clean path/file_01.py -i Then i selected: 4: ask each Finally, presseed 'y'...
JayadevBS's user avatar
1 vote
1 answer
308 views

I have the following state in a git repo: git status On branch whatever Your branch is ahead of 'origin/whatever' by 1 commit. (use "git push" to publish your local commits) Untracked files: (...
khmarbaise's user avatar
  • 98.4k
1 vote
1 answer
725 views

I was trying to remove an untracked file from a branch that I deleted, and instead I accidentally deleted untracked and tracked files... including apparently the dev and production databases!!! What ...
tomb's user avatar
  • 1,436
1 vote
2 answers
1k views

I really have hard time to understand how .gitignore file works... This is how my file looks like: custom/history cache *.log custom/modules/*/Ext upload sugar-cron* custom/application/Ext custom/...
Charlestone's user avatar
  • 1,260
0 votes
2 answers
11k views

I have a git flow question. I've worked in my code on a local 'developer' branch in git. Then after work was finished I did an add of all changed files and after that I committed it on my local ...
alfi92's user avatar
  • 1
11 votes
1 answer
11k views

This is not a general question about what '--' does, as in the marked duplicate. This is a git-specific question asking for clarity on what the operational differences are between the mentioned ...
M_M's user avatar
  • 2,135
1 vote
1 answer
521 views

I am testing Service Fabric along with a friend. We started with a .Net Core ASP MVC site Service (scaffolded out of the box). Then we added this .gitignore file. I built/deployed and tested the ...
alFadorMX's user avatar
104 votes
7 answers
317k views

I am trying to do a git pull origin master from my server but keep getting the error: Please move or remove them before you can merge. There are no untracked files, but it seems like it has issues ...
Brett's user avatar
  • 20.3k
1 vote
1 answer
1k views

How do I just checkout a branch into an existing folder in a pristine state? I am working in Windows 10. switched to a new branch of my project, and noticed that some existing (untracked) folders ...
prmph's user avatar
  • 8,454
0 votes
1 answer
448 views

First I ran git status [user@dev config]$ git status # On branch master # Untracked files: # (use "git add <file>..." to include in what will be committed) # # app1-core/ # app1/...
user994165's user avatar
  • 9,562
3 votes
2 answers
4k views

I hit this today: % git checkout another_branch error: The following untracked working tree files would be overwritten by checkout: __version__.txt alembic.ini alembic/README ...
LetMeSOThat4U's user avatar
11 votes
1 answer
9k views

mkdir repo cd repo git init mkdir temp touch temp/in.tmp touch out.tmp echo '*tmp' > .gitignore when use git clean -Xn it show Would remove out.tmp but I want to remove temp/in.tmp together git ...
Hanlin's user avatar
  • 855
4 votes
1 answer
1k views

I'd like to find a regex-way of using git clean. Without regex: git clean -dfx --exclude=".idea/" With regex (tried; not working): git clean -dfx --exclude='(.*\/)*(\.idea\/.*)(.*)' git clean -dfx ...
melvynkim's user avatar
  • 1,665
32 votes
2 answers
16k views

Hi I am curious about the difference between these two commands. When they introduce here: https://www.atlassian.com/git/tutorials/undoing-changes Looks like git reset --hard also sets both the ...
AlexWang's user avatar
  • 379
2 votes
1 answer
1k views

I'm using git filters (specifically clean) to sort some xml files before checking them into the repository. However, the local files remain as they were - even a smudge filter doesn't do anything (...
karlos's user avatar
  • 4,802
10 votes
1 answer
4k views

Is there any way to do something like git clean -d -x -f using GitPython? I need to reset working directories and want to get rid of all unversioned files without deleting the whole folder (except ...
Paddre's user avatar
  • 828
1 vote
2 answers
464 views

I'm on my "devel" branch and git status says "working directory clean". I want to look at a past release and so checkout a tag: git checkout tags/v1.0.0. After this some directories which were ...
Philipp's user avatar
  • 4,799
5 votes
3 answers
315 views

Our development environment uses multiple repositories as part of an overall build system. The build dynamically adapts depending on which repositories you have checked out: if you don't need to ...
Syeberman's user avatar
  • 141
5 votes
1 answer
3k views

I am trying to clean my working tree, however, when I enter git clean --force nothing happens. $ git status On branch master Your branch is ahead of 'origin/master' by 1 commit. (use "git push" to ...
BanksySan's user avatar
  • 28.7k
4 votes
1 answer
4k views

I have accidentally run git clean -df. It removed my files from my current commit, which I had yet to push. Now, in git status, those files are marked with D, which means "deleted". Is there any way ...
Java Developer's user avatar
1 vote
4 answers
596 views

How can I remove directories from untracked files that aren't appearing in git clean -n? Here are my steps: git status ...gives me: Untracked files: (use "git add <file>..." to include in ...
Ryan's user avatar
  • 6,237
8 votes
3 answers
6k views

I would feel much more comfortable using git clean if I knew I could undo the deletion in case something goes wrong. Does it support Recycle Bin in any way, shape or form? If no, are there any ...
sashoalm's user avatar
  • 80.5k
0 votes
1 answer
2k views

I would like to write a script that guarantees a successful Git checkout without intervention from the user. I don't mind dumping anything that cannot be solved without user intervention: for example, ...
lofidevops's user avatar
  • 17.4k
6 votes
1 answer
3k views

In a project I am working on I am using git and eclipse, eclipse creates a .project file in the project root. When I do a git clean I do not want to remove this file as I have to create this again. I ...
siebz0r's user avatar
  • 20.6k
41 votes
3 answers
13k views

When I have .gitignore data/* and run git clean -fd, the data folder and all its content files are deleted. What I want is to delete all unrevisioned files in a git repo while excluding all ignored ...
Danny Lin's user avatar
  • 2,357
2 votes
1 answer
118 views

git clean -d -f removes directories containing files which are ignored. Can I keep the ignored files and still run git clean -d? Example: dir\dir2\file1 .gitignore: dir\dir2 git clean -d -f ...
Coder's user avatar
  • 1,375
2 votes
1 answer
782 views

I would like git to clean up all untracked files that I have ignored. I thought that git clean -dX was the obvious solution, but it does nothing: # Set up test directory mkdir git-test && cd ...
nh2's user avatar
  • 26k
6 votes
3 answers
1k views

git clean -f -d removed files from my local directory as well How do I retreive them? I used it to remove untracked directories and files and found that it also deleted it from my local file system. ...
tan's user avatar
  • 1,569
3 votes
2 answers
12k views

I just used a "git clean" command and managed to delete my Documents, Music, and other directories. Is there a way to undo this and somehow get those files back? I did this via Terminal on Mac. Time ...
James Brown's user avatar