Showing posts with label Visual Studio. Show all posts
Showing posts with label Visual Studio. Show all posts

Monday, February 11, 2019

Git in Visual Studio 2017

Created new empty project in Git except for .gitignore file. No readme file was created.
Cloned in VStudio, and in master added a new test project.
The remote master history only shows the .gitignore add, as expected.
The local master history has same because no commits yet.
Now to commit and push to master by:
Commit All
Then switch to branches view and right click on local master and Push
This sent the new project to the remote master.
Created new local folder (VSGit2) for a second copy of VSGit repo, and cloned it from second instance of VS (we'll call this repo2 for this post)
Created a new branch "branchOne" of local master in repo1
Added a readme to remote master from GitHub interface and checked in to master. I verified this by viewing history in master from GitHub site.
But remote/master history from VS does not show the readme file.
 
Scenario:
Added a readme to remote master from GitHub interface.
Exercise: download and merge that readme file into local branchOne.
First lets bring down latest from remote/master to local master:
From local master, did a Fetch from VS. History now shows incoming readme.
Did a Pull, history now shows readme commit under "Local History."
And now VS remote master history shows the same thing.
branchOne does not have readme yet because that file was added to master in GitHub.
From merge dropdown/dialog, selected local master to merge to branchOne, unchecked commit.
Got a message saying I needed to commit. In changes area, I see the readme and I clicked "Commit Staged."
Scenario exercise completed.
 
branchOne is same now as local and remote master.
 
Moving to repo2, I do not see branchOne in remotes/origin, even after clicking refresh.
A history of remote/master does not show the readme commit.
 
Scenario:
repo1 now is up to date with master, now make repo2 up to date also, this time experimenting with the "Sync" functionality.
Exercise: Sync repo2 and see what happens, or "get latest"
Well, there is no Sync option.
Right-clicked on local master and Fetched. History now shows the incoming readme.
Pulled. History now shows readme, but no branchOne in local area. I do see it in remotes area.
Right clicked branchOne in remotes and selected "Checkout."
Now I see it in local. History does not show readme commit.
I could do a fetch and pull, but let's try a merge from local master which has all commits to local branchOne and keep commit checkbox checked.
Now readme file shows on file system and history shows all commits.
Scenario exercise completed.
 
History of remote/master shows all commits. I never had to fetch (I think, see above). I assume I could have or maybe should have. If so, then this merge and a fetch/pull does the same thing?
 
Scenario:
Bob (repo1) makes a change to branchOne's VSGitTestOne class. Then Bob commits and pushes and then creates a pull request that gets merged to master.
Meanwhile, Joe in repo2 has created a new local branch "feature1." Joe creates a new test class VsGitTestThree and commits locally only. 
Exercise: Joe in repo2 wants to keep working in feature1 but wants to merge Bob's work into his branch before continuing. So he must merge master into feature1.
Joe switches his local to master and fetches then pulls. History shows Bob's change and also the merge of his PR 3 to master.
Joe checks out feature1 branch and merges from master with commit after checked. feature1 history now shows all the master history plus its own commit of merge from local master.
Scenario exercise completed.
 
Bob and Joe are done with their branches.
 
Scenario:
Simulate Microsoft's release/deployment/hotfix branching strategy. See if this can be done without Azure.
Setup - release branch | PRx | hotfix PR | PRy and "cherry pick" merge of hotfix to release:
Bob and Joe are merged to remote master and it's the end of the sprint so let's create a release or deployment branch M1 off master:
In VStudio (didn't see how to do this in GitHub) did a fetch/pull on master to sync local from server. Then created branch releases/M1 w/ checkout. Then right clicked and Push Branch which brought it up to server.
Bob creates bobFeature1 branch off master and commits/pushes and pull requests to master.
An embarrassing typo is found and Bob creates bobTypo1 branch off master and fixes it, commits/pushes/pull requests, PR gets merged to master.
Joe creates joeFeature2 and commits/pushes/pull requests, PR gets merged to master. He does this without merging Bob's typo change, but there was no conflict during the pull request merge. (but somehow, Bob's typo change got into Joe's joeFeature2 branch. I didn't see when, maybe during the pull request?)
So now we have 3 PR's and we want to cherry pick the middle one into the M1 release branch.
 
 
 
from local branchOne, pull down that master change (new readme file)
While in branchOne, in Branches area in TS I pulled down the Merge link/dropdown and it brought up a merge dialog. In "Merge from branch:" box I selected local master. I got the message "Already up to date."
So I selected origin/master and unchecked "Commit changes after merging."
Again, "Already up to date."
Maybe merging
 
 
(no) I think the merge functionality is to merge between different branches, not the same branch.
 
Tried to create PR, but got "No commits between master and branchOne" which means nothing to merge into master from branchOne.
From local master, did a Fetch from VS. History now shows incoming readme.
Did a Pull, history now shows readme commit under "Local History."
And now VS remote master history shows the same thing.
 
 
Commit All - local only
Commit All and Push - local and push to remote
Commit All and Sync - local and push to remote and pull down any changes
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Saturday, September 17, 2016

New Project Connected to BitBucket Git Repo

(Using a Web API project)
 
Create project in VS2015 selecting "Create new Git repository" checkbox.
 
Click on Team Explorer Home toolbar button.
 
Click on Sync button.
 
Create repo in BitBucket.
 
Under "Publish to Remote Repository", click "Publish Git Repo"
 
Get URL to BB repo under Command Line link "I'm starting from scratch"
 
Paste then click "Publish"
 
Now click Sync, and with little or no indication of any progress you should see the files in BB.
 
You can change a file and check in then sync and it should appear in BB (or actually, I think you may need to put a change in, not sure)
 
 
 
 
 
 
 

Wednesday, October 28, 2015

Uninstall Visual Studio 2015 Enterprise

I had a bad install of Visual Studio 2015 Enterprise (iso from MSDN Subscription) and it would not run or uninstall, even with /uninstall /force.
 
Some of the error messages:
 
"Setup blocked"
 
"Failed to download the update xml file..."
 
This tool did the trick, it tells you where all of the .msi files are so you can uninstall Visual Studio bit-by-bit. All of the uninstalls worked. I probably missed a few, but when then I did the web install and selected uninstall and it uninstalled cleanly. I then was able to do a full web install that went perfectly.
 
Thanks to Aaron Stebner.