Delete a local git branch

How to delete a Test_Branch.

Switch to some other branch and delete Test_Branch, as follows:

$ git checkout master
$ git branch -d Test_Branch

If above command gives you error – The branch 'Test_Branch' is not fully merged. If you are sure you want to delete it and still you want to delete it, then you can force delete it using -D instead of -d, as:

$ git branch -D Test_Branch

To delete Test_Branch from remote as well, execute:

git push origin --delete Test_Branch

Check the link for more info.

Azure DevOps Git Clone error

I have changed my user’s name in Azure DevOps. When I try to clone to repo, started getting this error;

I have no permission issues then what the heck?

It turns out that the issue is with the URL. Please don’t try to connect to url which is produced by portal, something that look like this;

https://project-account@dev.azure.com/project-name/apps/_git/chart

instead try to connect thru your GIT username and then use password;

https://username@dev.azure.com/project-name/apps/_git/chart

If you username has special characters, Git cmd/bash will trhough errors, so replace those with valid characters;

@ can be replaced with %40

+ can  be replaced with %2b

Something like;

https://username%40xyz.com@dev.azure.com/project-name/apps/_git/chart

what a waste of time…

One of my developer started getting Git Credential Manager for windows popup and received Authentication failure message. The work around was;

Check the Git for Windows in the Tools – Get Tools and Features…), go to “Individual Item” tab,  check “Git for Windows”, and click “Modify”. Then it will ask you to update vs2017 to latest version, for example 15.9.36.

Voila, it started working.

Resource

https://stackoverflow.com/questions/34837173/authentication-failed-for-azure-git

Creating Repo and adding project using UI

Create a repo using Azure DevOPS UI;

Project Settings -> Repositories -> Create

Name Repository “Demo”.

Open command prompt.

git clone https://myOrg@dev.azure.com/[orgName]/[projectName]/_git/Demo

Create a project for example Demo in a separate folder;

Copy project file from separate folder to clone folder;

Open solution in clone folder. Commit changes and you are good to go.

Related links

Branching flow using UI

Follow these steps;

Click on Manage Branches. Select main branch. Select Sync to sync your local branch.

Everything looks good. Move on with creating a new branch.

Click on Manage Branch and New Branch.

Your view would be changed to newly created branch.

Start work. Change something in about.cshtml page, Save and commit; If that’s all you need to work on then push your local branch to remote. Click on Home icon; Click Sync.

You can see there are no incoming changes on this branch. there are outgoing changes that you have made. There is a message that’s telling you that this branch does not exists on remote server.

Click Push. You will see this view;

Click on “Create a pull request”. Create/Approve and complete your pull request on Azure DevOps UI. Your branches view would be;

Your merge is completed. Do a sync here.

Switch to main branch. do a sync here. You will see this;

There are two commits went into main branch. first one is the pull request merge and second one is the change you made. Click on Sync. It will pull remote commits to your local.

Your main branch is up to date for your next branch work.