Please consider this scenario.
My trunk has files A.txt, B.txt, C.txt, all the way to... Z.txt.
Branch has files A.txt and C.txt which I modified.
When I merge branch to trunk, the result is modified A.txt, modified C.txt and all the other unmodified files like B.txt, D.txt, etc.
However, I would like to have the trunk only contain the modified A.txt and C.txt.
How can I do that. Please let me know.
Since TFS include both TFVC and Git as source control, not sure which one you are using.
If you are using TFVC:
When I merge branch to trunk, the result is modified A.txt, modified
C.txt and all the other unmodified files like B.txt, D.txt, etc.
This is the expected and by designed behavior, we will not be able to delete any files which only exist in target branch during merge process.
You have to manually delete those files in target branch after merge process.
If you are using Git:
Please kindly review this solution: Make the current Git branch a master branch & How to replace master branch in Git, entirely, from another branch?
Related
I've been tasked with mirroring only a specific branch from our SVN repo with a full history, the branch that has to be mirrored has been tagged/cut sevral times. I've been using the Subgit SVN Mirror plugin on Bitbucket to do this. However, the mirroring only shows the history from when the branch was tagged. Is there a way to mirror only a branch while maintaining full SVN history in Git?
Our structure in SVN is similar to the following, where "trunk" is the origin branch, "feature1" was tagged from "trunk, "feature2" was tagged from "feature1" and "taggedTrunk" is the branch that needs to be mirrored:
/Project A
/branches
/taggedTrunk
/feature1
/feature2
/trunk
I've tried the following mappings:
1.
trunk = Project A/branches/taggedTrunk:refs/heads/development
branches = Project A/trunk:refs/heads/originalTrunk
includePath = /src
trunk = Project A/branches/taggedTrunk/:refs/heads/development
branches = Project A/branches/*:refs/heads/*
includePath = /src
Just to clarify, we're not trying to mirror the entire repo - in our Git repo we only want 1 branch having the full history
It is important where the "taggedTrunk" branch was tagged from and how exactly has it been created, by copying the source directory with 'svn copy' so that the copying information is present in the SVN history, or by copying with regular operating system "copy" and adding then so that this operation is reflected in the history as a simple adding, not copying.
In the former case the history can be obtained by adding the source branch into the mapping. That is, if the "taggedTrunk" was created by copying, say, "feature1", then adding it to the mapping
trunk = Project A/branches/taggedTrunk:refs/heads/development
branches = Project A/branches/feature1:refs/heads/feature1
includePath = /src
will bring the history.
In the latter case, I'm afraid, there is no way to get the history of the branch as SVN Mirror add-on won't be able to recognize and trace the history.
I have a TFS repository on Azure. I am using Visual Studio 2019. I have a TFS branch under a Development folder. I want to copy that branch and make changes to the branch copy, thereby preserving the original branch. How do I do this?
From the command line:
tf vc branch $/project/path/sourcebranch $/project/path/targetbranch /recursive
From the UI, right-click the sourcebranch and pick Branch from the UI, enter the target path and create the branch.
This will create a new folder in your TFVC repository with a copy of the sourcebranch. It will be parented to the sourcebranch as well, meaning any merges will go to the sourcebranch by default.
In some cases you may want to create the branch from a shared parent instead and cherry pick the changes from the current source. That will allow you to merge changes upstream without having to go through the current source.
I've migrated my SVN-GIT manually by just copying the folders to another git folder and pushing them to bitbucket. now i need the history of trunk from svn. can i get that now ?
If possible can i delete present trunk and move it back again. we are worried only about the trunk. There are no commits in trunk on bitbucket.
Just do a proper SVN to git migration (best with the KDE svn2git tool, not with any other like nirvdrum svn2git or git-svn, for reasoning see e. g. my answer at What dependencies does running "git svn" need to have installed in order to run correctly?), then force-push to BitBucket, that will replace what is currently in BitBucket.
Anyone that had this cloned and maybe made local branches based on it has to manually rebase of course like always with "Recovering from upstream rebase".
I'm trying merge my branches, but I get the error merge completed with conflict
http://prntscr.com/936x6n (as u see even with git gui i can't)
I tried skip database. So i added to .gitignore .mdf and .ldf, but still nothing. I can't merge branches. What should I do?
If you want to ignore some files during the merge, Git attributes using merge strategies for specific files could help. Here is an example that the specifies files stay at whatever version you originally had.
create .gitattributes in your repo and edit:
merge=ours
merge=ours
...
And then define a dummy ours merge strategy with:
$ git config --global merge.ours.driver true
We have an svn project that also has several plugins in vendor/plugins - all pulled in via svn:externals.
I have a commit that spans both the main project and several of these plugins all at once.
When I do an svn st it lists all my changed files across all the correct sub directories, but when I try to do an svn ci it only shows files from my local project.
How do I make a single commit that encompasses both the local changes and the svn:externals directories too?
Ok, it looks like it's not completely possible to combine local changes with svn externals, but you can combine all of several externals together and then checkin your local working changes afterwards.
To commit back to an svn:externals project you have to explicitly put the svn:externals directory name in the checkin eg:
svn ci vendor/plugin/<plugin_name>
You can checkin any number of different plugins all together on the same command-line with:
svn ci vendor/plugin/<plugin_one> vendor/plugin/<plugin_two> ...
But then your local working-copy changes have to be done separately.
If you don't, you'll end up with either a nasty warning telling you that is "Unable to lock" your local working copy and asking if "Are all the targets part of the same working copy?" OR you'll get some weird message saying
svn: Commit failed (details follow):
svn: Illegal repository URL ''
So it seems you must commit working-copy changes independent of your svn:externals commit. Still - at least it's only to, not N (where N is the number of plugins plus working-copy).
You can still tie the two commits together with the same commit-message.