when I run git tfs fetch there is no output. It doesn't seem to be pulling any new changesets from the tfs server. I then ran git tfs fetch -d and got the following output:
C:\projects\Infinity>git tfs fetch -d
Command run:git tfs fetch -d
No authors file used.
git-tfs version 0.19.2.0 (TFS client library 12.0.0.0 (MS)) (32-bit)
Fetching from TFS remote default
git command: Starting process: git log --no-color --pretty=medium refs/remotes/tfs/default --
git command time: [00:00:00.0330000] log --no-color --pretty=medium refs/remotes/tfs/default --
git command: Starting process: git log --no-color --pretty=medium refs/remotes/tfs/default..HEAD --
git command time: [00:00:00.0210000] log --no-color --pretty=medium refs/remotes/tfs/default..HEAD --
info: refs/remotes/tfs/default: Getting changesets from 60 to current ...
Cleaning...
CleanupWorkspaceDirectory: Could not find a part of the path 'C:\projects\Infinity\.git\tfs\default\workspace'.
the first thing that I'm not understanding is that the line ...Getting changesets from 60 to current ... The TFS repo is currently on changeset 59, and when I cloned the repo, it was on changeset 57. So on a fetch, I SHOULD be getting changesets 58 to current...
the second thing is the last error it gives me. Can anyone explain what is going on with the CleanupWorkspaceDirectory error?
EDIT:
One other thing I forgot to mention is that I have added another git remote to repository, and I have merged what's in refs/remotes/tfs/default with my branch that I have retrieved from the git repository. Not sure if that caused something in git-tfs to break...
the first thing that I'm not understanding is that the line ...Getting changesets from 60 to current ... The TFS repo is currently on changeset 59, and when I cloned the repo, it was on changeset 57. So on a fetch, I SHOULD be getting changesets 58 to current...
I don't have enough data to understand exaclty where your problem come from but I will try to give you enough understanding to let you solve it yourself...
The line Getting changesets from 60 to current ... tell you that in the 'default' remote, the last changeset found is the 59 and that git-tfs is asking to tfs the changesets from 60 to the last to see if there is changes in the 'default' remote path (for exemple $/project/trunk). If there is no changes in this tfs path, no commit will be created.
So your problem could come from 3 things :
changes have been made in your other tfs path (managed by your other tfs remote). Then you should either fetch from all your remote with git tfs fetch -all or checkout your other branch and use git tfs fetch -I (that automatically get the good remote) or git tfs fetch -i idOfYourOtherRemote (if you want to specify yourself the remote to use)
you have messed something with the git-tfs metadata that broke git-tfs (perhaps during your merge). Be sure that only commits created from tfs changeset contains metadata git-tfs-id:[http://server:8080/tfs/teamCollection/]$/.../;Cxxin the commit message. These metadata are important for git-tfs and should not be modified or added to normal commit not fetched from tfs.
(less probable) the commits from tfs has already been fetch by someone else in another git repository from where you have fetch. And the commits have been found already in your repository and not fetched again. But in this case, you should see them in the 'default' remote history...
One other thing I forgot to mention is that I have added another git remote to repository, and I have merged what's in refs/remotes/tfs/default with my branch that I have retrieved from the git repository. Not sure if that caused something in git-tfs to break..
perhaps. let's check your metadata...
the second thing is the last error it gives me. Can anyone explain what is going on with the CleanupWorkspaceDirectory error?
That's not a problem. During cleanup (after all the important work was done) , git-tfs try to delete the temporary workspace directory. Because you fetched no changesets, the directory is not created and can't be found.
Related
I have a problem with my local branches. When I am trying to do git checkout <branch> I get this error message:
error: The following untracked working tree files would be overwritten by checkout:
... (list of files)
Please move or remove them before you switch branches.
Aborting
I think that the reason is a fact, that in current branch I've renamed/moved some files with git mv.
All the files listed in this error message are listed with old path (i.e. path before moving / renaming action). Is there any way to work around this problem? I'd like to move to my master branch now, and merge it with current branch, so after that there should be no problem, yet for now, I don't know how to successfully switch branches (and then do a merge, if there might again be some problems).
Edit:
I was able to checkout using -f option, but the problem remains, because now I can't do merge, for the same reasons (actually, now the paths are the opposite, i.e. now error message contains new paths, that were used in database branch) and I don't know an option to force git to do this merging.
I am not sure, but probably the same solution would work for both checkout and merge problem.
Following #LutzBüch comment, I am trying to show exactly what happened in this repo.
I have branches master and database. The database branch worked only on a parts strictly related to database only. This part of code remained in a directory named let's say db. At some point, I had to change this dir name to DB, so I did some git mv's. Let's follow it from last merge, when everything still worked.
git checkout master
git merge database
git checkout database
git commit
{now the renaming happens}
git mv db/. tmp/.
git mv tmp/. DB/.
git commit {no other changes were made}
{added some renaming related changes, i.e. changed paths in 2 files}
git commit --amend
{now it's becoming the standard}
git commit {multiple times}
git checkout master {fails}
Last command failed with error message mentioned earlier. All files on the list had paths with the old dirname, i.e. db. After using git checkout -f master, when I tried to do merge I received paths with DB as the dirname.
I have searched everywhere and tried various solutions but am still getting the error:
Your local changes to the following files would be overwritten by merge
i have nothing to commit as status tells me the following:
# On branch develop
# Your branch is behind 'origin/develop' by 1 commit, and can be fast-forwarded.
# (use "git pull" to update your local branch)
#
nothing to commit, working directory clean
So then I do a git pull, then get the following:
Updating 67020e6..6dd23de
error: Your local changes to the following files would be overwritten by merge:
app/filename.php
Please, commit your changes or stash them before you can merge.
Aborting
But as I have nothing to commit and if I do a git stash I get No local changes to save
So how can I fix the problem and download and update my local machine with my remote amends.
Bit of history incase:
I have to local machines one at home and work I have done the amends at home and pushed them and I am now trying to update my local work machine with these updates.
EDIT UPDATE
As I cannot answer my own question for a while I found what for me solved this answer:
on the branch I wrote:
git reset --hard
Then the pull worked.
While looking around i tried the following that seemed to fix my issue at the time.
While on the branch i wrote.
git reset --hard
Had you ever previously done git update-index --assume-unchanged <file>? That could be a potential reason for your situation.
To fix, you do git update-index --no-assume-unchanged <file>. Then you should be able to stash your changes and continue with the merge.
Faced exactly the same problem. I was used to CVS before I started exploring git. I think running git pull --rebase origin master is the way to go for the kind of workflow that you and I use.
Refer to https://www.atlassian.com/git/workflows#!workflow-centralized for a more detailed explanation. I definitely know the answer is somewhere in that article, but I didn't understand the article completely.
I'm new to Github and I've been using the windows github tool which has proved a great help and handled a lot of things like SSH keys, prompts commits, discard a commit, revert commit, and it has a combined mechanism of pull+merge & push (sync), and a lot!
I'm learning it and trying to get its internal git command level executions. The other day, I merged a hotfix branch and then wanted to delete it -
git branch -d hotfix
I need to know how to delete it from the server as well. What are the git equivalents of the following two actions available in manage branch in the windows tool -
Unpublish a branch - remove only from the server
Delete a branch - remove locally and on server
Another thing I doubt is that the above git command was unable to remove the branch locally. I executed it, it removed the branch (didn't show in $ git branch) but if I restart the tool, the branch was still there! Was that a glitch?
If someone has been using these, can you pls suggest the best approach (I don't want to be totally dependent on the tool, I want to learn git as well).
In addition to
git branch -d hotfix
you also can remove it from GitHub:
git push origin --delete hotfix
You can see more at "How do I delete a Git branch both locally and in GitHub?"
If you have already deleted branches locally, a simple:
git push --prune origin
is enough to clean those same branches on your GitHub repo.
The opposite situation is when you have deleted branches on GitHub, while they are still on your local repo.
In that case:
git remote prune origin
See "cleaning up old remote git branches".
I had an issue where I accidentally copied a directory into a subdirectory of itself thus creating thousands of git transactions. After unsuccessfully trying to clean that up, I decided to create a new project and copy the files over from the old one. Somehow I think I've messed git up, but I'm not sure where the problem is. Here are my current symptoms.
I thought I initialized the git repository correctly. However, none of the files exist on github.
https://github.com/victorengel/matchismo2
... except what I created there.
The project itself is an iOS single view application that I created with git enabled. I copied over all the files I needed from the old project to the new project area, confirmed that it ran, and then tried a commit. The commit seemed to work, but the push didn't.
If I tried a push, I got a message that the working copy is out of date and that I should do a pull. If I tried a pull, it said there were uncommitted changes and I should abandon them or commit them. After some rooting around, I figured out that the change triggering this was a user data change that should have been ignored in .gitignore.
I finally have the .gitignore set up the way it needs to be. I think the repository is set up right on github.com, but I'm still getting errors.
I can commit but not push. If I try to push I get the message "Working copy out of date. Try pulling from the remote to get the latest changes, then push again."
If I try a pull, I get the message "matchismo2/master" is not a valid remote branch to pull from. Please choose a different remote branch.
Looking around at github.com, there is only one branch, master under victorengel/matchismo2. To me it looks like everything is set up properly, but apparently I'm missing something. What is it?
In Xcode, in the organizer, if I click on Branches, there is one item listed: master.
If I click on Remotes, there is one item, matchismo2, and if I expand it, master is listed.
I've been assuming this matchismo2 with master underneath it is what is supposed to match the "matchismo2/master" that's in the error message. Looks like a match to me, so why isn't it working?
EDIT:
If I try pulling from the GitHub application, I get an error message "There aren't any remote branches on the server yet." If I try publishing from GitHub, I get the following:
git: 'credential-osxkeychain' is not a git command. See 'git --help'.
2013-03-05 16:32:43.680 GitHub for Mac Login[68518:707] AskPass with arguments: (
"/Users/brillig/Downloads/GitHub.app/Contents/MacOS/GitHub for Mac Login",
"Password for 'https://victorengel#github.com': "
)
2013-03-05 16:32:43.763 GitHub for Mac Login[68518:707] Error reading attributes: OSStatus -2033889429
2013-03-05 16:32:43.764 GitHub for Mac Login[68518:707] Error reading attributes: OSStatus -2033889429
2013-03-05 16:32:43.919 GitHub for Mac Login[68518:707] Error reading attributes for password: OSStatus 840183217
git: 'credential-osxkeychain' is not a git command. See 'git --help'.
To https://victorengel#github.com/victorengel/matchismo2.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'https://victorengel#github.com/victorengel/matchismo2.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')
hint: before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
(256)
How about ensuring all your files are in order, renaming your branch, and pushing to the new (renamed branch) ? Then once you determine everything you need is actually there and your new code works, you can force update the master. Not an ideal way to do it, but it might work for you.
So to make a long story short, I've been working on a web app for the past few months. Recently I had to get a new laptop and cloned the repository from github onto my new machine... However whenever I commit changes to my app and attempt to use git push -u in the app's root directory i get the following message:
To git#github.com:acc/etc.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'git#github.com:acc/etc.git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g. 'git pull') before pushing again. See the
'Note about fast-forwards' section of 'git push --help' for details.
but when I try git pull git#github.com:acc/etc.git master I get a message telling me that the pull was aborted.
From github.com:acc/etc
* branch master -> FETCH_HEAD
error: Your local changes to the following files would be overwritten by merge:
config/routes.rb
test/fixtures/users.yml
Please, commit your changes or stash them before you can merge.
Aborting
so then i commit my changes using git commit -m 'fixing' and then attempt git pull again.
however this time I got messages stating that practically all my files had an "Auto-Merging CONFLICT"
am i totally screwed with this particular repository? I'm not really sure what to do since git is still somewhat new to me....
am i totally screwed with this particular repository?
No, but you will have to do a manual merge, since Git can't figure it out. git status will tell you which files need editing. The files themselves contain markers indicating where you should edit. When that's done, git push should work again.
If the changes aren't that big, consider making a copy of the entire folder/project in a different directory outside of the project, then git reset --hard HEAD will wipe out, erase and delete your recent changes.
You can then apply them again individually using your save3d copies for refernce.
Make sure sure you git add before git commit of course.
Finally if you get auto commit merge issues you can always just edit the files manually to resolve.