ChatGPT解决这个技术问题 Extra ChatGPT

Visual Studio 2015 How to merge a branch into master?

I am new to GIT, so far I had been using Visual Studio Online TFS for my version control and I am the only developer. When I created my last project I was kind of mislead into thinking GIT was the best option for this.

So I checked-in my master. Then when I was going to work on a Feature I read I had to create a branch (this was not necessary in TFS) so I created "development_print" as a new branch and worked on my feature.

Now my feature is complete but I don't know how to merge it back into master. I am not interested in multiple branches at the moment, just want my new feature merged into master and remain with master.

In VS there is a merge branch option but it only allows me to merge into development_print (I want my feature into master!) so it does not let me set Into Current Branch and for Merge From Branch shows:

Development_print

master

origin/development_print

origin/master

which is kind of confusing? it seems all backwards. So how do I get out of this mess without losing all the work I did on the feature?

Checkout into master, and merge your feature into master
Also you don't have to use branches with git, it just makes things nicer many times, especially with several developers.
I did on Git Command Line outside VS: git checkout master followed by git merge development_print and my feature is in. How do I make sure I am now working on the master branch? if possible I would like to get rid of the development_print branch now that I merged. I suppose the merge did commit as well.

C
Class Skeleton

The way to merge development_print branch into master branch as below:

VS -> Team Explorer -> Branches -> double click master branch -> Merge -> select development_print for Merge from branch -> Merge.

The select box shows:

development_print
master
origin/development_print
origin/master

That means you have branches development_print and master for both local and remote. origin/ means branches exist in remote.

If you don’t want the development_print branch after merging you can delete it for local and remote:

Team Explorer -> Branches -> select development_print -> right click -> Delete -> select development_print under remotes/origin -> Delete Branch From Remote.


To clarify double clicking on 'master branch' actually switches you to the master branch right? So if you go to Solution Explorer you'll have the files of the master branch there rather than the branch?
V
VonC

You can follow the Microsoft tutorial "Create work in branches".
Also, as shown in "Getting Used to Git in Visual Studio: Branches" from Jeremy Bytes (2014, but should still apply), you can go back to the "Branches" section and select "Merge".

This gives us drop-downs to fill in:

https://i.stack.imgur.com/fAIun.png

You can see the branch section in "Microsoft Application Lifecycle Management", also used when you created your topic branch:

https://i.stack.imgur.com/E8hd8.png


For the other task I simply worked on the files on the master branch without using the development_print branch but when I try to check-in there is no option to associate a Task ID to the Change set like it always did in TFS. It appears the only way to be able to associate a Task ID to a change set is by doing the work on a branch and then merging.
u
user11714042

In VS switch to master branch to be your current branch and from Team Explorer -> Branches you should get the Merge options in the right order where you will be able to select in the "Merge from branch" drop-down development_print branch and the "Into current branch" field will be preselected with master.