git-clean

Does git clean support moving to Recycle Bin?

佐手、 提交于 2019-12-21 04:50:46
问题 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 workarounds that anyone knows of, such as an external tool using git clean -n to print out the files, and then moving them to Recycle Bin? 回答1: Put recycle.exe into your %PATH% Run git config --global alias.recycle !git_recycle.sh Put git_recycle.sh in your %PATH% : #!/bin/bash cd ${GIT_PREFIX:-.} git

Does git clean support moving to Recycle Bin?

坚强是说给别人听的谎言 提交于 2019-12-21 04:50:14
问题 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 workarounds that anyone knows of, such as an external tool using git clean -n to print out the files, and then moving them to Recycle Bin? 回答1: Put recycle.exe into your %PATH% Run git config --global alias.recycle !git_recycle.sh Put git_recycle.sh in your %PATH% : #!/bin/bash cd ${GIT_PREFIX:-.} git

Git: Exclude a file with git clean

北战南征 提交于 2019-12-18 11:47:13
问题 i'm working on a big python project, and i'm really sick if .pyc and *~ files. I'd like to remove them. I've seen that the -X flag of git clean would remove untracked files. As you can imagine, i'm not tracking .pyc nor *~ files. And that would make the trick. The problem is that i've a local_settings.py file that I'd like to keep after the git clean. So, this is what I've got. .gitignore: *.pyc *~ local_settings.py When I execute this command: git clean -X -n -e local_settings.py I get this

How can I recover files after accidentally running “git clean -df”?

二次信任 提交于 2019-12-18 08:59:24
问题 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 to get those files back? 回答1: git clean only untracked files and not committed ones. You might have done other operations if you see D as the status for already committed files. You get back those files, do: git checkout . or git reset --hard 来源: https://stackoverflow.com/questions/25722470/how

Reduce git repository size

不羁岁月 提交于 2019-12-16 20:01:59
问题 I tried looking for a good tutorial on reducing repo size, but found none. How do I reduce my repo size...it's about 10 MB, but the thing is Heroku only allows 50 MB and I'm no where near finished developing my app. I added the usual suspects (log, vendor, doc etc) to .gitignore already. Although I only added .gitignore recently. Any suggestions? 回答1: git gc --aggressive is one way to force the prune process to take place (to be sure: git gc --aggressive --prune=now ). You have other commands

Git: need to recursively 'git rm' the contents of all bin and obj folders

浪子不回头ぞ 提交于 2019-12-03 11:42:37
问题 Someone by accident just commited all of their bin and obj folders to our repo (there are around 40 such folders). I would like to do a git rm -r on all of these folders. Is there a command to do this? 回答1: Have backups, find . -type d -name bin -exec git rm -r {} \; find . -type d -name obj -exec git rm -r {} \; Update With bash, you can set the shopt globstar, and be happy: shopt -s globstar git rm -r **/{obj,bin}/ Finally, if you need to remove these from the history of the repository,

Git pull - Please move or remove them before you can merge

不羁岁月 提交于 2019-12-03 04:04:33
问题 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 with the ignored files for some reason. I tried running a git clean -nd to see what would be deleted and it lists a whole bunch of files that are ignored in .gitignore . How can I fix this so I can do a pull? 回答1: Apparently the files were added in remote repository, no matter what was the content

Git: need to recursively 'git rm' the contents of all bin and obj folders

自作多情 提交于 2019-12-03 02:08:46
Someone by accident just commited all of their bin and obj folders to our repo (there are around 40 such folders). I would like to do a git rm -r on all of these folders. Is there a command to do this? Have backups, find . -type d -name bin -exec git rm -r {} \; find . -type d -name obj -exec git rm -r {} \; Update With bash, you can set the shopt globstar, and be happy: shopt -s globstar git rm -r **/{obj,bin}/ Finally, if you need to remove these from the history of the repository, look at git filter-branch and read the section on 'Removing Objects' from the Pro Git Book Once you revert

Git pull - Please move or remove them before you can merge

家住魔仙堡 提交于 2019-12-02 17:52:53
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 with the ignored files for some reason. I tried running a git clean -nd to see what would be deleted and it lists a whole bunch of files that are ignored in .gitignore . How can I fix this so I can do a pull? Apparently the files were added in remote repository, no matter what was the content of .gitignore file in the origin. As the files exist in the remote repository, git has to pull them to your

git clean: What does “Would not remove” mean?

喜你入骨 提交于 2019-11-30 14:35:21
问题 When I run git clean --dry-run the results are a bit like: Would remove an_untracked_file Would remove an_untracked_file_2 Would not remove some_unrelated_folder/subfolder/ The "unrelated" folders are tracked and have had no changes, so I would not expect git to remove them. But, why does git report Would not remove for some, but not all, of my project's normal (and totally untouched) folders? Can I tell what is causing git to consider, but then decide against, removing them? git status lists