If I create pull request from a remote branch and that branch get deleted when the PR is merged, occasionally I'd like to create another pull request from that branch - which I still have locally. When I click sync in Visual Studio, it's smart enough to just recreate the branch if it was deleted, but VS Code throws the error
Git: fatal: couldn't find remote ref feature/somebranch
Is there a way to get VS Code to recreate the missing branch like Visual Studio does?
Related
I can't check out another branches then the Git Changes interface gave me an error "Object reference not set to an instance of an object."
I've seen this error when trying to work with an empty Git repository in Visual Studio.
Specifically, when trying to check out the URL of a freshly created repository with no commits at all in it. The project that results from this can scan the repository for any later changes but encounters the "object reference not set to an instance of an object" error whenever it tries to check out a branch.
I haven't found a way to correct it in place, but what worked as a workaround was deleting the Visual Studio project and using another Git client to make any commit at all to the empty repository. Even just a README.txt file is enough to establish a master branch, and from then on Visual Studio can check out the repository into a new project, which can create new branches without encountering this error.
There are some files to commit before checking out another branch. Adding these file by command git add . in command line interface
I have a project in Visual Studio 2019 that I cloned from an empty DevOps project. It is using git. I have created a local branch in Visual Studio from master and added a new solution. I have then committed the changes, synced with the server and pushed the commit. On DevOps I created a new pull request to merge my branch into master, then approved and completed the pull request.
When I checkout master in Visual Studio and pull, it updates to the latest commit. However, I do not see the Solution in the Solution Explorer (it is empty). I pull again and it says I'm up to date.
I have tried merging from remotes/origin/master also to no success. I have tried fetching remotes/origin/master no dice. I have tried deleting master and recreating it using so that it tracks remotes/origin/master with: $ git branch -d master and $ git checkout -t remotes/origin/master and still no joy.
Thank you for reading my query. What am I missing?
Closing and re-opening Visual Studio fixed this issue for me.
I have subsequently created a new local branch from master, made some changes, pushed them, submitted and completed the pull request, and now checking out master and pulling DOES show my changes.
Not sure why it wasn't working before but my problem has been solved.
I faced the same when the Azure/Git credentials are expired or the domain password is expired.
In fact, there is a bug in VS 2019 (16.11.2 my version): no error displayed if VS failed to obtain auth. token during the pull operation.
I'm in the middle of migrating a repository from TFS to Git, and I'm using git-tfs.
I've already converted my Trunk branch using 'git tfs clone ...' successfully. When trying to 'git tfs branch --init' a related branch it fails with the error message: 'error: TFS branches $/foo/myrelatedbranch not found!'
This seem to be caused by the $/foo/myrelatedbranch no being a proper tfs branch. The 'branch' documentation (https://github.com/git-tfs/git-tfs/blob/master/doc/commands/branch.md) seem to be pretty clear on the related branch having to be a PROPER branch (https://github.com/git-tfs/git-tfs/blob/master/doc/commands/branch.md#merge-changesets-and-branches).
The branch $/foo/myrelatedbranch has been deleted a while back, so I'm not able to see the option 'Branching and Merging -> Convert to Branch' in the Source Control Explorer.
Is there any way of making this deleted directory a proper branch in TFS?
Using Visual Studio 2015 and TFS 2015
You can configure the Source Control Explorer to show deleted items:
From the menu bar choose Tools, Options.
On the Options dialog box, navigate to Source Control, Visual Studio Team Foundation Server.
Select Show deleted items in the Source Control Explorer, and then choose OK.
If you now open the Source Control Explorer, you can view the deleted folder and convert the folder to a branch.
You can also rollback the changeset that deleted the folder. The rollback will create a new changeset where the changes are negated (so in this case, where the folder is added).
If the problem still exists, you could just take a snapshot of the latest version and migrate that to Git.
I know several people has already asked this question but I tried almost every approach and did not help me. I am trying to delete a branch in TFS 2010 and I am unable to do this operation. When I try to checkin my delete operation I get following message
TF14098: Access Denied: User xyz needs Checkin permission(s) for $/Path to branch/*.
I remember until few months back, I was able to delete the branch but not it is not working.
I modify the files inside the branch but when I try to rename the branch or try to delete it then I get above error message.
I have tried method proposed in this answer: Removing branch mapping in Team Foundation Server 2010
I would like to add one more thing. If I create branch using visual studio 2010 then I can delete that branch later however if I create branch using visual studio 2013 then I can not delete that branch.
I would like some advice on how to use Git locally on my computer along with Visual Studio and a TFS server. Unfortunately the technical leader of my company has set TFS with the exclusive check-out policy and so every time someone checks out a file, it can't be edited by someone else.
What is the right way to make the two systems live together? I would try to use Git-TF but I'm not convinced with the checkin phase. The workflow should be as the following:
clone the project
switch to offline mode for Visual Studio
work offline with Git
fetch from the TFS server and rebase
check-in?
The problem is: how do I check-in my files if someone else has already checked out the files I need to change? How does Git-TF really work when checking-in files?
Another workflow that came to my mind, without Git-TF, could be the following:
open the TFS project
switch to offline mode
create a new branch with Git
work on the branch
return to the master branch, update it
exclusively checkout the files which have been changed on my Git branch
merge the branch on master
check in with TFS (after switch to online mode?)
What do you recommend?