Someone upgraded our TFS to Azure Dev Ops a couple of years ago. If I drill down one of the repositories in a project, there are dozens of folders some of which have branches within them. The icon I have boxed in red I assume is a branch:
I have created a brand new repository in DevOps via the browser interface, and while I have been able to create a few folders with projects, files, etc..., I cannot find a way to create a branch within a folder.
In Repo -> Branches, I see a New Branch button, but that branch will be created at the repo root. There does not seem to be a way to place a branch within an existing folder.
Is that correct? If not how can it be done? Perhaps via the command line somehow? Is this structure in the other repo because it was converted/imported from TFS?
There are two version control systems available in Azure DevOps / TFS:
TFVC (Team Foundation Version Control) and Git.
TFVC is a centralized version control system and is considered feature complete and no longer undergoing development. You can have one TFVC repo per Team Project. It supports folder-level branching within the repository. The screenshot you posted is from TFVC.
Git is a modern version control system. It is fundamentally different from TFVC on a deep technical level and does not support folder-level branches; branches are only at the repository level.
If you created a new repository within the team project containing your TFVC repo, it is, by definition, a Git repository.
The branches and merging strategies that you follow for TFVC and for Git are generally not interchangeable because of these core differences.
So to succinctly answer your question: You can't do what you want to do. If you are using Git, please look up common Git branching models such as GitFlow and GitHubFlow and choose one that is appropriate for your development scenarios.
In Repo -> Braches
You could create new branches within an existing folder with the format:
Folder Name/Branch Name
Related
I have one android project in perforce and one iOS project in github. Same project for different platforms. They share some file. Can I cherrypick certain changes to my github repo from perforce?
Right now, I do the work manually and it is very error-prone. Can I automate the process somehow?
We currently support two branching strategies; gitflow and trunk-based dev. My company started using what I'd call a hybrid (read not correctly IMO) gitflow model, but the direction of the company is to move to trunk-based development. I like the direction, but what's the best way to do this? I'm looking for best practices, but was unable to find this topic discussed online.
We use GitHub for SCM
In our hybrid gitflow branching strategy, our git projects are not currently (IMO) using the gitflow "master" branch correctly.
Should we:
Create new git projects in GitHub and archive the older gitflow based git projects
Block access to the "master" branches in the gitflow based git projects
Delete the "master" in the gitflow based git projects, and then follow trunk-based dev
Thanks
I was in a similar situation and wanted to switch from Git-Flow to Trunk-Based development.
This is how I ultimately solved the dilemma of a headache-filled attempt of merging massive amounts of code from 'dev' to 'master/main':
TL;DR: Replace 'main/master' with 'dev's code entirely, in your OS. Commit changes. Merge 'dev' into 'master/main'. Lock dev.
Detailed process -
Switch to 'dev' branch
Make a copy of 'dev' on your local drive in another folder
Switch to 'master/main'
Delete all contents from your local drive for this branch's folder, EXCEPT for the .git folder
Copy all the contents, EXCEPT the .git folder, from the backup/copy of 'dev' from step 2 to the 'master/main' branch's folder
Do a 'git status' and see that there are a ton of changes
git commit, and git push
Now your 'master/main' contains exactly what 'dev' does.
Finally merge 'dev' into 'master/main' so history/tooling shows that they converged
Lock the dev branch
Implement Trunk-Based development and CI best practices
Best wishes!
On my Azure DevOps I cannot see branches. How can I enable branches?
If you choose TFVC(Team Foundation Version control) as version control when you create a new project, the default repo will have no Branches page.
So, you can choose git as version control when you create new projects or create a new repo in this project. A project can only have one TFVC repository but can have multiple git repositories.
You can refer to the documents and learn more about Git and TFVC in Azure DevOps.
If you use TFVC you can't see the branches in the menu, you will see them under the "Files":
Only if you use Git you will see the Branches in the menu:
At the new workplace where I work, in the past, the main project was split in two branches, because different customers began to have very different requirements. A pretty common scenario I guess.
Now, I'am not a developer but a sysadmin, and not an expert of git, but I was wondering if in these cases usually is the correct approach to use branches, because in my understanding a fork would be more adapt.
What the CTO is asking me to do, is to migrate this branch, into a new git repository. But he also says that he wants to still be able to perform comparisons between commits, therefore (in eclipse + egit) to right-click on workspace > team > show in history > select the commits he wants to compare > click on compare to each other. I believe that these requirements conflict to each other, so my main question is: is it possible to compare commits of different git repositories?
My second question is, if a project with the same core that starts to require different features, should be branched forked or moved to a new repository?
Hope my question is not too broad
There is no concept called fork in Git. Git hosting services, such as Github or Gitlab, provide such a feature. As far as Git is concerned, a fork is essentially just a branch. And also, every clone of a repository - even local repositories - are essentially forks.
To split up your repository into two repositories that have a fork relationship, first just create a clone of the repository. And then delete branches in both repositories that refer to commits of the now-other-repository.
The usual approach to compare forks is to add a remote to the other remote. This is possible in your case too, since you have common commits in both repositories, before the forking-point. More on remotes here: What is "git remote add ..." and "git push origin master"?
I'm not sure about the exact terminology but once I create a new project on VSTS, I want to have two folders/repositories under it i.e. "Master" and "Dev".
Dev will be the one I'll use on a daily basis and Master will contain the stable version that will be deployed to the staging site.
Two questions:
What is the right terminology for what I'm talking about? Are they
repositories or folders or something else?
How do I create these two repositories/folders under my project?
Here's what I've done so far:
First I created my new project
I then navigated to the project and want to add those two repositories but not sure how to do it.
Where do I go from here?
You just need to create Dev branch for the repository.
Steps:
Create a Team project with Git Version control, by default, there is master branch
Go to Code tab=>Branches
Click New branch button to create Dev branch from master
On the other hand, you could create a git repository in the team project with Team Foundation Version Control, then create dev branch in this repository.