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.
Related
I searched for similar questions posted here and on the web, but none of them refer to my case.
In some way, I accidentally created a duplicate local branch as you can see in the attached screenshot. My guess is that I created it somehow when I was working with git stash with multiple stashes.
This duplicate branch appears only locally. And moreover, the command git branch in this repo returns only the master branch.
How can I fix this and remove the duplicate local branch? I do want to keep the tags in their place (and I do see them in GitHub so they indeed exist in origin/master branch although they do not appear here in origin/master). Thank you for your help
Editing due to comments:
Before all that mess I accidentally caused, I only saw a single line in the git graph (the blue one) and the tags appeared on it. there was no parallel line next to it showing the same commits. BTW, I cloned the repo to a new location and there I see what I expect - a single line with the tags appear on it. Moreover, I can't push to git from VSCode, but I do succeed in pushing from gitbash, this makes me wonder whether this is some bug in VSCode.
git log --all --graph --format=oneline --decorate prints the expected proper graph, with no duplication:
For other people facing the same issue.
I'm not sure why it happened but it was caused by the tags created using the git-graph extension in VSCode.
To fix this: manually deleted all tags locally only and then fetch them back using git fetch --all --tags.
Note that if the tag was also pushed separately (possibly create/push by another collaborator), a git fetch --tags would bring it back.
While it was not the case for the OP, the command "Git: Delete remote tag" can help, and is introduced with VSCode 1.75 (Jan. 2023) with PR 170415 from the 2020 issue 104845.
This is available in VSCode Insiders today.
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.
i just updated to Xcode 5 and my project is using GIT, after update completed suddenly question marks appear in project navigator file near each file.
when i am trying to Commit i don't see what files have been changed, i cannot pull also
and when i am trying to push it gives :Push Success" message but the repository on GitHub don't updated.
You probably did not set up your git repository properly. There are ways of adding external git repositories, but they tend not to work well for github (in my experience) and always lead to these sorts of issues.
If you want to set up a remote git repository through github on XCode these are the steps you should take.
Make the repository on github. Make sure to add the .gitignore file for Objective-C.
Clone the repository.
Go to XCode, press "create new project"
Create the project in the folder you cloned the repo to. I always name it the exact same thing, but I don't know if that is necessary.
Make sure not to select create local git repository.
This will definitely create a project that is under version control by a remote git repository hosted on github.
Quick fix is to Create or Save the new project 'outside' the directory (say Desktop) that is not linked to your github/bitbucket
I have an old project (RAILS) I'm trying to get up and running again. I (probably stupidly, but too late now) renamed the repo for various reasons (using gem 'rename' + changing github..etc).
There appears to be a submodule attached to the project, (related to a minor change that was hacked onto formwizard) that is refusing to play ball. I've tried just about every approach I can find, but I just can't get rid of it.
Currently if I try git submodule init I get:
No submodule mapping found in .gitmodules for path 'public/javascripts/formwizard'
In order to get that far I had to clone an old version of the repo to it's original position.
Otherwise I get
fatal: Not a git repository at $path_inc_old_project_name
I just want this thing to go away and stop being linked to my main repo. Nothing i do seems to work
This solution fails as submodule deinit isn't recognised (have upgraded to latest install of git using homebrew).
git rm --cached path_to_submodule
Just returns
fatal: 'path_to_submodule' is outside repository
i.e. the path you need is outside the repository
I know that, that's why I'm trying to get rid of the damn thing...
I've tried removing every reference to the old project name with a find replace, but the git repo still seems to know where to look for this submodule.
How can I tell git to just forget about this submodule...? (or in fact, all submodules as this is the only one I have)
I have a pretty big problem. I am going through a Ruby on Rails tutorial, and they have suggested that I use GIT for version control. I have never used it before, and through the tutorial I don't think I used it right. Here is some back story.
I created a new project, and then I created a new Github repository. I named them the same thing, and I pushed my project to that repository. I then looked at Github, and all of my project files were there. I then went through a few chapters of the tutorial, and followed there instructions for pushing files to GIT. After awhile I realized, that none of my files were being uploaded. I didn't really care, so I went on with the tutorial. Still pushing files to GIT even though they were not showing up.
IMPORTANT
My Github repository only had the few files from when I first created it, the project on my local machine has a MANY more files. In the last chapter of the tutorial I was able to follow, it told me to do these commands:
$ git add .
$ git commit -m "Finish layout and routes"
$ git checkout master
$ git merge filling-in-layout
Once I did those commands, my project located on my local machine lost ALL of the files I created in the last couple of days. My guess is that Github replaced my files from my local machine with the files on Github (Just the files created when I started the project)
I think I have been adding files to GIT on my local machine since the folder '~/.git/logs/HEAD' has all of the commits I made, with what looks like GIT file numbers.
Any help would save me so many hours.
Thanks, -Chris
You committed some changes, then got the old version and reverted to it by issuing "git merge filling-in-layout". (you created a branch "filling-in-layout")
whatever you do DO NOT -> git reset --hard <- DO NOT.
what does "git branch" say?
do this:
git checkout master (or one of the others)
and look which one is yours. ;)
Erase github from your mind. It is irrelevant. The git repository is on your machine, inside your rails app folder. That is the beauty of git. So everything you have ever committed to git while working from that folder is there. It's possible you made some mistake along the way, or that the tutorial instructed you incorrectly, but you can look through all your commits with "git log", and then just go back to the point where things were good: checkout that commit (thus recreating the situation as it was at that moment), and pick up again from there.
Pedagogically I would suggest that you not try to learn git and rails simultaneously. They are both big and interesting, but they are completely orthogonal (that's fancy talk for "they have nothing to do with one another"). If you want to learn rails, learn rails. If you want to learn git, learn git. Just a suggestion.