I had some untracked files in my Xcode project and while working on the project I wanted to discard all the changes that I had made.
So I went to Source Control > Discard All Changes in Xcode (it seemed like such an easy option). But, to my surprise, git deleted all my untracked files.
Is this the expected behavior?
git does have a command to remove untracked documents : git clean -fd.
If XCode triggered this git command when running Discard all changes, I'm afraid this is bad news.
If such is the case, you will have to turn to Time Machine or undelete utilities to try and recover your deleted files. You can also send a bug report to the XCode team ...
It would seem weird for an IDE to have such an easy way to massively remove files from the disk, though. Try to read the documentation to see if git clean was triggered, or if the files were moved in some sort of secret place by XCode, or something like that.
Related
I have added some files to .gitignore, then run the command git clean -options to clean some untracked files. (Sorry, I don't remember what options I used). Then, Rubymine can't load all files in my projects. I open the project source tree, and all I can see are the following files .gitignore, Gemfile, Gemfile.lock, Readme.md, and some other unimportant files. I think the problem occurs because of the git command I use above. I am wondering if anybody has faced this problem before. Any suggestions are appreciated.
Check this, hope this may save you
git reflog it is explained here
http://gitready.com/intermediate/2009/02/09/reflog-your-safety-net.html
Also remember you can always go back to your previous stable commit git checkout [revision] or undoing your changes.
https://www.atlassian.com/git/tutorials/undoing-changes
I have cloned my TFVC from VSTS and it pulled all my branches without any errors. I then followed a number of online posts that said to cleanup my projects by doing the following:
Remove the GlobalSection(TeamFundationVersionControl) section from solution files
remove all *.vssscc files
Remove all *.vspscc files
When I do this I get almost all of my files showing up in the Changes window under Team Explorer. All of these files have no changes when doing a diff except for the files discussed earlier.
What is the proper way to cleanup branches after doing the clone from TFVC to git?
Thanks
If you want to migrate an existing TFVC repos to Git repos, you can use the git-tfs tool, which allows you to migrate a TFVC repo to a Git repo in just a couple of commands.
In my example, with the commands below, I have successfully migrated an existing TFVC repo to Git repo with all branches.
If you don't want to clone the branches, you can specify --branches=VALUE (VALUE=none|auto|all), check https://github.com/git-tfs/git-tfs/blob/master/doc/commands/clone.md
When I do this I get almost all of my files showing up in the Changes window under Team Explorer. All of these files have no changes when doing a diff
That should be due to a bad end of line setting...
except for the files discussed earlier.
First commit them...
Then fix your setting.
You've got 2 options (not mutualy exclusive, you could do the 2. But if you do only one, do the 2nd) :
(old style), set the git core.autocrlf setting. On windows, that's either true to convert all file to a windows eol style or false to tell git to not touch the files. It's a matter of choice. This settings will be used for ALL your repositories but will be personal
(new one recommended) Add a .gitattributes files to telle git how to handle eol for all type of files. This settings will be used for this repository only but will be shared by all the developpers and noone won't be able to commit bad files.
Be aware that for all the strategies that you will try, to be sure that it works, you will have to do soemthing special. You will have to wipe all the files and checkout them all from the repository (because that's at this special moment that git modify the files):
git checkout .
There is a possibility that in fact, the files are modified because they have been checkouted in the format you wish, so commmit them all (you will be obliged) and apply the eol strategy, just after...
A good doc on the subject that you should read carefully and understand before trying something...
PS: handling end of line is not an easy task in a git repository and it will take you quite some time and you will have to try a lot of things before really understanding how it works ( I'm not pretty sure myself ;) )
I'm wondering how this is possible.
I made quite a bit of changes to my rails project (deleted some stuff, edited files, added files, ...) as I implemented a whole new design.
And now I want to commit my project and push it to github
git merge new-view
git add .
git commit -am "implemented the new design"
git push origin master
Now when I pulled the changes on another computer I noticed that not all of my features were working. (for example the image slider wasn't functioning).
When I go trough the files, it looks like all the changes I made are there, but I must be missing something because both projects are not behaving in the same way!
Even when I clone the project again from github (on the original computer with the working projectfolder), the feature still doesn't work.
git clone projectname
Now in my old folder I can't push any other changes as status tells me that my branch is up to date with origin/master
git status
I figure that I can just delete the github project and upload it again, but that's obviously not the way this is supposed to be done.
Any ideas what could've gone wrong?
Make sure that no important files are being ignored- see this answer
Make sure everything is truly committed. git status and git status --cached
Make sure any databases are initialized, migrated and populated with the same data.
Check browser caching.
I'm having an issue with Xcode trying to commit some changes to a Git repo. Today, I created a branch from master in order to work on future updates of an app while keeping the ability to fix the release version.
The problem I have occurs when committing changes. I get the following error message:
error: pathspec 'Furtivus.xcodeproj' did not match any file(s) known to git.
The thing is, back in the early days of the project, I changed the name of the bundle and the project and it is no longer called "Furtivus". I've tried looking into the .git directory where my local repository is located. I've also tried looking for any files containing "Furtivus" on my mac with no results. I can't find where to change this name.
Obviously Git is trying to find the old project that was renamed, so how do I change that?
I've done a lot of searching, in the documentation regarding Git, and on Stackoverflow and nothing seems to cover how to handle Git and a project name change.
I have SVN set up on a server and have pushed the Xcode project onto the server. SVN has been working for committing changes made to a file or multiple files back to the Source Controlled copy. However I am unable to add new files (such as when creating a new View Controller or adding an image for example) to SVN. They exist just locally and I cannot figure out a way to get them into source control.
I tried committing the file and receive this message:
I have also tried right-clicking the file, source control > Add. But that option is grayed out:
Is there something wrong with the SVN setup or with the way I have checked out the repository? Committing changes to an already existing file works just fine.
Thanks, any help would be greatly appreciated!
Xcode is setup to use Git now. If you can switch to git you'll be a much happier camper.
use git init, git add . from command prompt first and use gitignore to add the xcuserdata file to the ignore list. Once you do a commit -m "Initial" from the command prompt you should be able to start committing from Xcode.