I am in Git madness right now!
I changed the name of my xcode project by clicking on the project name in xcode and changing the name from oldproject to newproject.
That changed the name of the project everywhere except for the folder (in finder) containing the project files. My OCD kicked in and I changed the directory name where the project files reside. I then had to manually point xcode to the location of the project files (by selecting the project in xcode, opening the utilities window and updating the "Full Path"). The app still works fine.
Now comes the Git part. I checked git status in Terminal and it said that I needed to add the directory newprojectdirectory/. I did and then did a commit. And now I can do commit and use Git as normal going forward but I can't see any of the oldprojectdirectory/ revisions.
Any thoughts?
Thanks
If you want to track history beyond rename, it's normal.
git doesn't track history of renamed file like other files.
it is just like 'remove & add newly'
but, you can use --follow option
git log --follow rename-file
and you can see history beyond rename, however it works only for a file.
use that:
git mv -f [file-original] [file-renamed]
Related
I am using git with Xcode but when i commit files using Xcode (not command line) after committing and pushing to remote, when i use git status this is the result.
What are Untracked Files. What should i do with them?
And what about Changes not staged for commit part? What are they?
These untracked files are files that have been added to your directory structure (e.g. it would appear that you did a pod install), but you have neither added them to source control nor told git to ignore them. (I would tell git to ignore them, personally.)
But you have to decide whether you want to add the Pods directory to your repo or whether you'd like to ignore them. See https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control. (I personally don't put Pods into source control, just the Podfile and Podfile.lock. There are many opinions on that topic, though.)
Re the .DS_Store, we often have a ~/.gitignore_global that tells it to ignore those, too. Once you tell it to ignore these, they will be removed from the “untracked” files list. See .gitignore all the .DS_Store files in every folder and subfolder.
Re the unstaged .DS_Store it looks like your repo already had that one .DS_Store in the repo. I would suggest removing it from the repo. See How can I Remove .DS_Store files from a Git repository?.
In short, it looks like you have a project with no .gitignore file (or it is missing entries). It also looks like you don’t have a ~/.gitignore_global to ignore .DS_Store files.
For an example of a .gitignore that you might use for Swift projects, see https://github.com/github/gitignore/blob/master/Swift.gitignore (though, like I said, I generally would uncomment the Pods from that particular .gitignore).
I took over an iOS project completed by objective-c. The project does not use git, and I want to use git to manage it locally.
I performed the following steps, and then when I submitted, I didn't know which files to add to the tracking file. (I created git to ignore files)
Steps i did
I opened the terminal and entered the following command:
cd /Users/xxx/Desktop/xxx/Myproject
git init
touch .gitignore
open .gitignore //I manually added the ignore rule in .gitignore and saved
git status //我没有修改任何代码,而且没有执行 git add ,因为我不知道该添加哪些文件到追踪文件
This is ignore file
Should I execute git add .? Or should I choose some additions?
I hope you can tell me the method and reason, I do n’t understand what I found on Google.
I had not heard of this file until I randomly checked git status in an old repository and there it was, a file I had not edited myself nor ever seen before. I do not know how it got there.
It seems it's common asked about - mostly how to remove it (e.g. here and here).
What is this file, and what created it?
.idea is the dir for saving the project configurations for all Jetbrains IDES (RubyMine , Pycharm , PHPStorm , WebStorm ..etc)
you can handle it using two ways if you don't want to commit it to the repo
Ignore it only for yourself
in .git/info/exclude
add /.idea
Ignore it in .gitignore so it will be ignored for everyone who uses the repo
by adding /.idea to .gitignore
if the dir .idea already tracked by git you will need to remove it first from the cached files before ignoring by git rm -r --cached .idea
This folder can include important configuration if you did any custom configuration for the project and also include the indexed data for the IDE which helps it to provide quick autocomplete and in certain cases would be better to commit it to the repo but I always ignore it because the other developers in the team don't use RubyMinee
I'm developing an iOS app with XCode 4.2 and latest SDK.
I have added to my project a folder with several files. This folder is a real folder in Finder.
When I try to commit those files I get the following message:
svn: Commit failed (details follow):
svn: '/Users/User1/Fuentes/iPhone/Desarrollos/TurismoCR2/TurismoCR2/Descripciones' is not under version control and is not part of the commit, yet its child '/Users/User1/Fuentes/iPhone/Desarrollos/TurismoCR2/TurismoCR2/Descripciones/021es.html' is part of the commit
How can I fix this error?
Probably I could add these files and folder manually but I don't know how (and I don't want to make a mistake).
You need to do:
cd /Users/User1/Fuentes/iPhone/Desarrollos/TurismoCR2/TurismoCR2
then:
svn add Descripciones/
Try this:
step 1:
svn ci
step 2:
Then vim or vi will be automatically offered by the svn (with svn diff file name) then type the required string or massage and save it.
Done.
When I try to put images into the Resources folder of my project, I got this message :
fatal: Not a git repository (or any of the parent directories): .git
How can I fix that?
Had the same problem. I copied a project then tried to delete files.
If you want to be able to edit the project, type git init folder in the terminal. This will re-initialize the git in your folder.
Go to Organizer->Repositories and remove the Corresponding repository.
Faced the same problem in Xcode 4.6.1 after moving my folder and xcodeproj file. Here's what works for me:
Delete corresponding repository in Organizer
Close Xcode
Delete the original .git directory
git init in the new directory where you placed the folder and xcodeproj file, and do an initial commit
Start Xcode
In order to do anything in Git, you have to have a Git repository. This is where Git stores the data for the snapshots you are saving.
so just go into your project directory let say you have a project name test_project just go into that directory and type the command
git init
and this will work.
Perform these two steps in Xcode 11, to get rid of this error:
In the menu, select Source Control > Create Git Repositories.
Click on the Create button.