問題:時にはそうではないが、Gitはリポジトリの static
ディレクトリを削除する。私たちはそれが何を引き起こすのかはっきりしていませんが、ブランチをマージしたりブランチをチェックアウトしたりするときに発生するようです。それは尋ねることなくこれを行い、追跡されたファイルを食べる。
背景:
- I have a (private) project which has a few branches, 'release', 'develop', multiple feature lines.
- There are two of us (me and @stevejalim) working on the repo. This problem happens to both of us.
- I am using purely the command line for my git commands; Steve is using a mixture of the command line and Git Tower.
- It's a Django project with a
static
directory. We may have git rm
ed the static
directory at some point in the past, or put it in .gitignore
, but not recently. And the head of our develop branch doesn't have static
in .gitignore
and has files in static
tracked.
- This happens so infrequently that we're not sure if it's something we're doing, or an intermittent problem, a bug with Git, or a corrupted tree
- It might happen only when merging another branch back into
develop
. But branches are always branched from develop
and back into develop
. But we're not sure.
We are using git-flow, but the issue happens when using non-git-flow commands, too.
As examples of when this can strike:
1) Steve had a develop branch that was clean (no changes to commit or stage) and stable. He cut a new release with git flow release start|finish
and in the process (possibly the back-merge from master to develop), the entire /static/ tree got deleted.
2) Steve repaired the delete by discarding the changes (to essentially undelete the file). But then, Steve simply switched from master back to develop and the /static/ dir got zapped again (this was with Git Tower)
3) Sometimes just merging from a feature branch to develop as an interim merge can trigger it. It does seem to happen most often when cutting a new release, though
それは/ static/dirのザッピングをどのように修復するのかと関係がありますか?削除されたものを一括取り消しする最良の方法は何ですか?ローカルの変更を破棄することも、HEADにハードリセットすることも、事態を治すことにはなりません。 rebaseは私たちを助けるかもしれない?
UPDATE We've just experienced this again simply with a git add .
- no changing branches, no merging. Does that help diagnosis at all?
Steveの.git/configの内容は次のとおりです。
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = [email protected]:foobarbazbam/bar.git
[branch "master"]
remote = origin
merge = refs/heads/master
[gitflow "branch"]
master = master
develop = develop
[gitflow "prefix"]
feature = feature/
release = release/
hotfix = hotfix/
support = support/
versiontag =
[difftool "tower"]
cmd = \"/Applications/Tower.app/Contents/Resources/CompareScripts/kaleidoscope.sh\" \"$LOCAL\" \"$REMOTE\"
.gitignore
の内容は次のとおりです。
.DS_Store
*.pyc
*.log
*.log.*
*.bak
*~
settings_local.py
/build/
/static_collected/*
/static/uploads/*
/static/theme_files/*
/static/picture/*
pip-log.txt
*.tmproj
*.dot
*.db
*.sublime-project
*.sublime-workspace
/docs/_*