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.
Related
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
I am new to GitHub. I don't know the correct process to merge my changes with the upstream. I followed following steps using EGit (I like to use it because I find it simple). Please help me.
On GitHub I created a fork.
For my fork I cloned a repository in Eclipse and imported respective projects.
In remotes, I added one more for the main project say Upstream(from where I forked) on GitHub.
I added some changes into my local repository.
How can I do the following part? -
Now in the meantime other people added some changes to the upstream. Now I want to integrate my changes(in the fork I created) to the latest changes(upstream) using EGit and push it to my repository and send a pull request.
Please help me.
create another remote corresponding to your fork in Eclipse
publish (push) your changes into your fork repo on github
create a merge request from the web interface in the original github repo, pointing to your changes on github
There is the procedure, how I do it.
GitHub browser UI
delete your fork with too much mess, if exists - this is in your Settings -> Danger Zone, the button is in upper menu bar in the root of fork
fork for you a new one on the foreign page, where I have access
open newly created fork and copy URI to the clipboard
Git perspective in Eclipse
create clone of your fork in my GUI Eclipse
Create a new branch in local branches and activate it
Import project from working tree in Eclipse as general project from Git perspective to actual workspace
do changes, integrate your important files to the general project (add to index etc.)
commit, push
GitHub browser UI
create Pull request from your fork directly from actual branch (recommended) or after merge in master branch
Notice, that in the picture is merge branch selected. In our real case is better to use the name, which is more descriptive.
Scenario: I'm mostly working with Eclipse to develop plugins. We have our repo that represents our development activities. Now I sometimes need to make some changes to a number of Eclipse or other 3rd party plugins, which are themselves hosted on Git. Then I need to have those modified plugin projects available as part of my codebase.
What I would like to do is to integrate all the remote repositories into a coherent local version where I can pull updates from those other read-only repos, but the changes that we make can be seen in our own repo, just like any other local working directory.
It sounds like you want to use the git subtree command http://blogs.atlassian.com/2013/05/alternatives-to-git-submodule-git-subtree/
"The command to update the sub-project at a later date becomes:"
git fetch tpope-vim-surround master
git subtree pull --prefix .vim/bundle/tpope-vim-surround tpope-vim-surround master --squash
"When it’s time to contribute back to the upstream project we need to fork the project and add it as another remote:"
git subtree push --prefix=.vim/bundle/tpope-vim-surround/ durdn-vim-surround master
My buddy gave me his git address for the project we are going to work on. In Eclipse using egit I cloned his branch.
So now in my Git view I have my own repository I created of an existing project. I want this existing project to be on my buddies branch so we can both check it out and have it in our repo.
Unfortunately I am using Windows to do this because we are developing a game and I do all of the art & animation in addition to programming. I would feel much more comfortable on the cmd line than using this plugin..
Any help is much appreciated!
The notion of repo and branch are quite different.
If you have a clone of our buddy's repo, you can work on a branch named like the one your buddy uses (by default 'master' if he hadn't created any other), and everything you will push will be added/merged to the remote branch in the remote repo.
For more on Egit, see this "Git with Eclipse (EGit) - Tutorial", and check if yuo can push at least one file, that your colleague will be able to pull from the remote repo and see directly in his branch.
If I fork a project that's hosted on github. Do I fork all the branches? How do I know which branch my fork is based on? In other words which branch will be downloaded to my PC?
Think of it this way:
The repo[sitory] corresponds to the collaborated work of the team across one or many branches. All contributors have their own copy of it.
Each fork of the main repo corresponds to a contributor's work. A fork is really a Github (not Git) construct to store a clone of the repo in your user account. As a clone, it will contain all the branches in the main repo at the time you made the fork.
Each branch within the fork and/or in the main repo can correspond to several kinds of things, depending on how you want to work. Each branch could refer to a version of the project but can also correspond to different channels of development, like hotfixes or experimental work.
The pull request (in the GitHub ecosystem) corresponds to the task. Every time I want to contribute an isolated finished task to the main repo, I create a pull request corresponding to the commits made in that task. These commits are pulled from either my fork or my branch to the main repo.
A commit is a set of changes to the code. This is one of the most interesting things about Git. You don't transfer files, you transfer logs of changes.
All branches on GitHub will be copied in a fork. (Obviously, this doesn’t include branches that were never pushed to GitHub in the first place.)
But a fork is a GitHub-to-GitHub operation; nothing is copied to your PC. It’s not quite the same as a Git clone. If you mean to ask “what’s copied when I clone a project?”, see the manual for git-clone(1).
Fork is a clone on the GitHub side (it clones everything).
When you are cloning a repo, you are getting the all history of said repo, with all its branches.
Even though you can in theory change the default branch of a remote repo, a clone from a GitHub repo mainly look for the master branch. Meaning to change the "default" branch a GitHub clone will get, you need to rename the master branch.
If you fork a project, you are making a copy of the whole project to your git hub account. you are not coping anything to your PC
To make a copy in your PC you have to clone it and pull all the stuff and you will got all branches & code of that project
This can be explained very well. You have a central repository at GitHub. Whenever you take a clone of it on your personal computer to do some changes, this local clone of the main repository is called a fork.
The branch is something different and is included in the fork/repo. Actually the branch is your work at different stage of development. They are created as and when required to save a set of functionalities, to give access to different users, to demonstrate the site to client, etc.
If you create a fork of a project from the Github website, you get all the branches from the upstream project.
If you clone from your newly minted fork to your local PC, you will have the origin remote on your PC pointing to the master branch of your fork on Github.
I would like to share a real life example of when we use Branches and when we use Forks
We have GitLab at our shop and sometimes we have to work on packages from a Laravel project. We normally create a branch and push changes to the branch that we have been testing in our local VM dev environment when working with the actual Laravel project.
Let's say our project is located at
https://github.com/yardpenalty/mainproject.git
Branch usage:
Lets say the branch is called It_doesnt_matter
Once we have our branch the way we want for production we then make our final push to this branch and create a merge request which then goes into UAT for testing.Once the test has went through QC the changes are merged into production.
The merge from the It_doesnt_matter branch is now pushed to the master project
at https://github.com/yardpenalty/mainproject.git
Let's say the package project is located at
https://github.com/yardpenalty/mypackage.git
Keep in mind the mainproject uses this package in production so we can't make changes by simply pushing them to this package (among other reasons). Let's say a web dev has to edit this package to make changes on production.
A simple branch wont work either because we can't see our changes without publishing the package etc.
Fork Usage:
Now is when we have to do a little bit of trickery with our package so we create a clone of the production package via a fork. The composer.json files can be updated to point to the fork which is now located at a User or Group path
So we will create a fork in https://github.com/yardpenalty/mypackage.git
and call it https://github.com/yardpenalty/yards/mypackage.git
Now we can update our composer.json file to point to this package in our "repositories":[ array like such such and away we go!
{
"type": "github",
"url": "https://github.com/yardpenalty/yard/mypackage.git"
}
]