I am new to git (may be too new) I created a branch to play around with rubber (ec2 deployment) for deploying my rails app. Unfortunately it didn't go as planned, and then i decided to remove the branch (branch -D rubber_experiment_branch). I was thinking this would also remove the files that were generated while i was on the rubber_experiment_branch. Apparently even after deleting the branch the files that were added remains on the disk and i guess my understanding of how this all work is obviously wrong. Also want to add, i didnt commit any of those changes to rubber_experiment_branch.
can someone tell me how do i actually get rid of the files added in the experiment branch - is there git commands that would help me with this? Whats the ideal git approach for a scenario like this?
Thank you开发者_StackOverflow中文版!
Git won't mess with any files that you haven't git-add'ed. Try 'git clean' to clean out files that git doesn't know about.
If you made a branch and then made some new files, what probably happened is that you didn't tell Git to track those files, so Git didn't know they were associated with the branch. Git has a concept of an "index" which is an intermediary state between your local copy (changes Git doesn't yet know about) and the repository. If you make a new file and you want Git to start tracking its history, you have to do git add filename
, which adds it to the index, and then commit, which takes any changesets in the index and says "these are good to go" and makes the change part of the commit history.
If you type git status
command line, Git will show you a list of all untracked files, and other information. You can then delete those files manually. If you know you don't want any of them, then jdelStrother's answer is better than mine and you should use git clean
精彩评论