How Can I Re-Baseline an Azure Repo - visual-studio

I'm a rank novice in Azure DevOps and I was using a local coding project in VS 2019/Team Explorer to learn about GitHub, Azure, version control, pipelines, PRs, etc. I created a project, added files and, for quite a few months, I thought I was getting the hang of it. A bit of overkill, but it was worth the learning experience.
Then a few days ago, after a month's hiatus, I returned to complete work on a local branch and nothing seemed to work correctly. I can't recall what errors initially appeared (I attempted way too many "solutions" without really understanding what I was doing) but edit conflicts showed up, I couldn't sync, pushes didn't work, and nothing I could think of would allow me to resynchronize (not in the Team Explore sense) with the remote repo. Edits I make in local files no longer show up as Changes in Team Explorer ("There are no unstaged changes..." despite my editing files, no "Commit" or "Stash" command is enabled).
How do I wipe the project's repo slate clean in Azure? I just want to start over, learn from my mistakes and carry on fresh.
I would like to establish a new baseline, if you will, clear all the branches, commits, PRs, and the work items. I would like to keep the Project settings, the Overview (Summary, Wiki, Dashboard) and possibly the pipelines.
Do I need to create a new project?
Any advice would be appreciated.

For the issue in Visual Studio:
You could try to re-connect the Project in visual studio and clone the Azure Repo to a new Path.
In this case, you can get the latest Azure Repo content again. Then you could make changes in local and push them to azure repo.
For the requirement: establish a new baseline
You don’t need to create a new project. You can directly create a new repo in the current project and push the files to the new repo.
Here are the steps:
Step1: Navigate to the old repo and select the branch that needs to be moved to the new repo. You could use the “Download as Zip” option to download all files to local machine.
Step2: Create a new Repo in the current project.
Step3: Unzip files on local machine. Connect to the new Repo in Visual Studio.
Then you can add all files as changes to push to azure repo.
The new repo will have no old branches, PRs and commits. But other parts will not be affected.
Hope this helps.

Related

Xcode says local is out of date, but I am trying to completely replace the GitHub repo

I wrote a tiny application and checked it into GitHub. I then wanted to make it cross-platform, so instead of trying to build that out, I restarted with a new project and selected Multiplatform->Game. As part of this I made a new local repo, and once it was up and running, connected it to the remote.
Now the new project is very different than the old one. And so when I try to Push, it complains that "The local repository is out of date." I tried doing a Pull with Stash, and that happened without any errors, but I still get the same error when trying to push. A Refresh File Status indicates no changes.
Reading many (many!) threads here suggests that it should just work, you should be able to completely rebuild a remote just by pushing. So I suspect the issue is in Xcode? Any advice on how to get this code into the repo?
If you create a new repo and select a license, the resulting LICENCE file will always conflict with the local even if there are no differences. This is not indicated in the Xcode display, nor does github report any differences online or in the CLI.
So... if you are making a new repo, do not select a license if the project contains one.

How to use GitHub in VS 2015 so a moron can understand?

Downvote if you want... but I need a set of simple basic steps that we can follow. We have VS Enterprise, no GitHub add-ons installed. We have a an empty repo created on GitHub. What do each of the developers do after that? There's a local repo, right? Should there be another project on the local machine that commits to the local repo or do we open the project in the repo? If yes, how do we create that other project? What about the .sln file that VS lovingly puts in a separate folder? We have been at this for hours and believe me we have tried every combination of commit/push/sync/goat sacrifice except the right ones. We cannot reproduce consistent results such that two developers can work against the same remote repo. Sometimes one developer can push and he doesn't see the files pushed by the other developer. Sometimes the Commit Message text box lights up but the Commit button is disabled. I thought I was reasonably intelligent until I started working with GitHub.
I'll give you the broad steps you need to do. You may need to fill in a bit of the detail. THis is how I would work it. I am sure you could get many other opinions.
Create the repo on GitHub (which You already have done.)
Each developer should then go to the GitHub repo and fork the repo under their own GitHub account.
Each developer then needs to clone their repo to their local machine. (That's the beauty of Git. Every developer has the entire repo locally.) You can do this in VS2015 by choosing: File -> New -> Repository -> Clone.
Go to your on-line repo and get the URL of the repo that you will be cloning. Enter it into the New Repo dialog box in VS.
When working on the project, each developer should create a temporary feature branch, which they push to their own GitHub repo. They can then push their work as often as they want without it conflicting with other developers.
When a developer thinks that their work should be merged into master, they should go to GitHub and issue a "Pull Request" for their feature branch.
Their PR can then be discussed among the team before it is accepted.
Once it is accepted and merged into master, the developer can delete their feature branch locally and on GitHub, if he likes.
Since "master" on the team repo has now been updated, each developer will need to pull down master from the team repo to update their own local and remote repos.
It sounds more like an how-to-use git issue. You probably first need to see how two collaborators work on same project with git. I donot think either VS or GitHub has anything to do here, as both only provides you git gui tool regarding this issue.

How to use private github repository for ios apps

I'm currently starting to develop an ios app with some friends. We'd like to use a private github repository for version control so we can collaboratively work and push changes to the code. Xcode 5 creates a local git repository, but there seems to be some differences between using git for an iphone app versus the class projects (java projects like connect 4) that I've been used to.
I've created a repository on github, and pushed an initial commit from my local xcode project to the github repository. However, I'm not sure if others will be able to download the code and import it into an xcode project and have it work as intended.
For one, the files on github are organized differently than it displays from my workspace in xcode 5. From the project navigator, most of the yellow folders (folder references, which I don't fully understand) aren't actually folders, and don't appear on the github page. Also, many things (infoPlist.strings, frameworks) are represented in a humongous "project.pbxproj" file, along with confusing build information.
I know that this is a vague question, but I really had no idea what to look up or read. Let me know if there's any way I can improve asking questions on stack overflow. Also, if you know any guides that would help me out with this kind of stuff, I'm all ears.
Introduction
Git and Xcode work wonderfully together to create applications that foster teamwork and minimize versioning complications. However, it's important to understand the basics of Git before proceeding. This answer will walk you through the steps of integrating Git with Xcode, which really isn't too complicated once you understand what's going on.
The difference between Git and GitHub
(The OP might know this distinction, but this is really for anyone else who visits this page and is confused)
The first thing to understand is that Git and GitHub are two completely different things. Git is a version control system, like Subversion (SVN), or PerForce. It can be used independently of GitHub. GitHub is a cloud repository storage system that is integrated with Git. That's why it's called GitHUB; it's a HUB for your code and all it's versions/commits. Git can work with many repository storages, one of them being BitBucket. (This is unlike Subversion, which doesn't have a local repository and a remote repository; you have to push changes from your local repository to your remote repository in Git).
The question asked how to integrated GitHub with Xcode - the evil answer to that is you do not; you integrate Git with Xcode (which Apple has already pretty much done for you). When you commit something in Git locally, you push to GitHub, where your code is stored, and where others (e.g. team members or the public, depending on your privacy settings) can clone or fork your repository and build on it.
Create a remote repository
Let's assume you're starting from scratch. If you're not starting from scratch and already have code in a remote repository, skip this step.
In this step, you want to create your repository on GitHub or BitBucket. Follow the instructions that these sites give you to create the repository.
Getting the URL to Clone the repository
Whether you're using GitHub or BitBucket, you have to be able to tell Xcode where you are storing your code. Find the URI that allows you to clone the repository; GitHub and Bitbucket should have easy steps for finding these. Usually look for the word "clone" on the main screen of your repository, and you'll find it.
Clone locally
Fire up Xcode, with a new project. Hit the "Source Control" menu bar item, and select "Checkout". In the popup where it says "Or enter a repository or location", copy the clone URI that you acquired in your previous step. Then hit next. When asked to clone, Xcode will prompt for a branch; pick which one you want for now. If you have no idea what branching is, then choose "master".
Conclusion
Now you're all set. From now on, most things you need will be under the "Source Control" menu bar items as well; this includes committing, pushing and pulling. Enjoy, and good luck!
Setup the Xcode project as shown here.
Once, done you can see which file’s have been added,modified etc in project navigator.
https://www.dropbox.com/s/r5gsfh2raxwkam6/Screenshot%202014-07-30%2015.03.03.png
For commit,push, or to discard changes, use
Here’s detailed tutorial : http://www.raywenderlich.com/51351/how-to-use-git-source-control-with-xcode-in-ios-7

Publish local Git repository to Team Foundation Service

About a week ago Git support was added to Visual Studio 2012 and Team Foundation Service. I've been playing around with it a bit and wanted to publish a local repository to my team project. It's described in step 2 on the Team Foundation Service website:
Publish your local Git repository into your new team project.
Now I've been doing the exact same thing, but I don't get the "Publish to ..." context item. Could this be a bug or am I missing something?
I was having the same problem. I don't know why.
However, after a bit of playing around, I managed to get the following
working. Disclaimer: can't guarantee this is actually the correct way
to do it. It may bork things further. And whether it does the same as what the missing 'Publish' menu item is supposed to do, I have no idea. Use at your discretion...
Get the url of your git repo in the project you set up in TFS.
Go to your project in the TFS web interface, then Code tab.
You should get a message that gives you the URL.
e.g. https://user.visualstudio.com/DefaultCollection/_git/YourProject
Edit the .git/config file on your local repo.
Configure the origin remote to point to your TFS repo.
(note: if you already had an origin remote, you might want to rename that first to keep it)
e.g.
[remote "origin"]
url = https://user.visualstudio.com/DefaultCollection/_git/YourRepo
fetch = +refs/heads/*:refs/remotes/origin/*
Open your solution in Visual Studio.
Edit a file.
Do a commit.
Do a push.
This should hopefully push your local repo to your TFS remote as origin.
From here things seem to be working for me -- the code is up in my TFS
web interface at least, and I can push commits to it. I can add backlog items etc. I'm new to TFS though so not sure if it's actually all working as it should be.
I was just having the same problem, and the answer by ngm didn't work; I had to do the opposite. The [remote "origin"] section was already in my .git/config file, however the project code wasn't uploaded to TFS.
To fix it I just deleted that section from the config file, then restarted Visual Studio and followed the official instructions.
I had this same exact problem. I was able to resolve it by restarting Visual Studio completely, opening Team Explorer, then navigating to my local repo. I opened up my local .sln, then clicked on "Changes", "Commits" and it then had an area where I could Publish the project to a URL. I took that URL such as: https://myapps.visualstudio.com/DefaultCollection/_git/MySolution and then clicked "Publish" (I had to do it twice.) I can now commit to the TFS and view my code online.
I had the same issue. I had to delete all of my remotes in .git/config (not just origin) before the Publish option is available. Apparently, Microsoft assumes you would never even dream of using a different remote.
I found it helped to start a new solution and publish from there going step by step.
Once it's 'confused' itself it's best to start the process over. I got it working and never had to edit that file.
I tried all of the above but the only way I could get it to work was to use git hub for windows.
To make that work you will need to set up alternate credentials. https://tfs.visualstudio.com/en-us/home/news/2012/aug-27/
For submitting an existing local repository to TFS-Git:
Create new project in TFS.
Using Git Extensions, select the local
repository that you want to push to your new project in TFS.
Select the push arrow.
Select Manage remotes.
In URL, enter the location of your TFS project: https://[your site
name].visualstudio.com/DefaultCollection/_git/[Your project name]
Save. Do you want to automatically configure push and pull? (I said yes.)
Close.
Select dropdown box for Remote - select the Remote URL you just
saved.
Push.
While setting up my account at TFS, I did set up an alternate credentials, though I am not sure if they were needed for this process.
I am new to GIT and TFS, but this process allowed my to push two of my solutions, each with three projects into TFS. Also, within Git Extensions, I found that I could organize my local repositories into categories, which proved a convenient way to organize my projects into their solutions. I would like to do the same in TFS, too.
I had the same problem today, I was not understanding why this "Publish to..." menu didn't appear.
I found that it's because you have to map one online repository to a local one, no more.
In your example, it seems Gittyup online is already mapped to Gittyup local, so you have to create a new Git project in the web interface, then you connect to it in VS, and then you can publish your local repository to the online one.
In the Team Explorer window find your repository under Local Git Repositories. Right click on the one you want to change and pick Open Command Prompt.
Now type git remote -v and it should show you the remote name and the complete url for it.
type git remote remove origin assuming origin is the name of your remote repository. Then git remote add origin [url] replacing [url] with the actual url of your repository.
Now you should be able to push your master branch into the repository for your team project.
I can confirm other answers, that the GIT repo cannot have any remotes listed or VS13 won't add it to the team project. I was using Atlassian tools Stash / Bitbucket / SourceTree and as soon as I closed VS13, removed all the remotes, reopenened VS13, opened the team project, and right clicked on my local GIT repo. The option "Publish to {teamProject}" was available and the .sln was then available by opening the team project.
Same problem here, except instead of editing git config files, just delete the entire git repository folder for the project. Reload the project and start over with Source Code action under file. Then add all changes to the project to the local Git. Then "Sync" and it will display the url textbox.
Create the project in VSTS/GitHub/somewhere, then from Git Bash...
git remote add origin https://xxx.somewhere.com/_git/xxxProjectNamexxx
git push -u origin --all

How do you set up github version control for a team of two?

We're trying to set up github version control for a Jsp-project in NetBeans 7.0.1. The problem is we don't have a clue what to do. I Have set up a public account on github and done all the steps in the install guide on github, ssh keys and everything. So if I wanted to work on my own in this project I wouldn't have a problem.
The problem is how to get my collaborator started. He has an account on github. he set it up with ssh keys and such. In the admin view on github I added him as a collaborator, but we don't know the next step.
So the question is how to connect the collaborator to the project? something like this I suppose?
git remote add origin git#github.com:username/Hello-World.git
git pull
(another question: Do I git only the source files or the whole project folder?)
Regarding your second question... That's a tough one.
A few months ago I was working with a colleague on a JavaEE project and we initially decided to share the whole Eclipse project. Since I was working on Windows and he was working on Linux, we had much trouble maintaining everything. Also we had to make sure that we don't accidentally push up our .project dir, because that would overwrite the settings on the other persons machine, messing up the whole project. So we ended up removing all the project files from the repository and just keeping the source folders (src and WebContent).
Both of us set up an empty project, made our settings and than imported the source code from the repository. Was some trouble setting it up until everybody had the same project settings, but afterwards it worked like a charm.
For just two developers that is fine, I guess for a bigger team, there might be better solutions.
So, I guess Netbeans handles the project settings in a similar way. So in my opinion you should just share the code.
For the first access, what your collaborator should be able to do is a git clone of your repository.
That will set for him the remote address.
If he is declared as a collaborator, he then should be able to push/pull to that remote repo.
Note that your collaborator should have received a push notification access.

Resources