How to exclude certain branches from git-tfs clone operation - tfs

I'm busy experimenting with git-tfs do tfs to git conversion. I understand the cmd below will clone everything and convert TFS branches into the git repository:
git-tfs clone http://tfs:8080/tfs/DefaultCollection $/Project1/Trunk --with-branches
There are a number of branches I don't want moved over - is there a way I can exclude one or more specific branches?
thanks

You won't be able to exclude any branches during the clone operation. It's an all or nothing operation.
Remember that branches in git (pointers to commits) are different to branches in TFVC (folders) so if you're not planning on pushing back changes to the TFVC repository afterwards then you can simply delete the branches you don't want by using git branch -D operation on each of the branches you wish to exclude.
After the clone don't forget to do a git gc and a git tfs cleanup to minimise the size of your git repository.

Related

Restore merged branch in bitbucket

Long back I have created a pull request to merge my branch into master and it was done. I think the merged branches will not be available on Bitbucket for longer time? (Anyway, my branch is not available).
But, is there a way to recover that branch in Bitbucket?
I know how to recover it on git/sourcetree, but I want in Bitbucket to create another branch from this.
I have used this command to recover my branch to sourcetree,
git checkout -b <branch> <sha>
Created a tag from last commit of my branch and created branch from that tag.

Using git pull properly

I am new to git so please bear with me. I have a rails application on my local machine that I am experimenting with and pushing to the master branch periodically. It works at the moment, but I have fallen behind, and now I am many commits behind the master.
$ git branch
* master
$ git status
On branch master
Your branch is behind 'origin/master' by 27 commits, and can be fast-forwarded.
(use "git pull" to update your local branch)
nothing to commit, working tree clean
However, when I use git pull and then start rails, my application breaks with a precompiler error. So I am forced to use git --reset to go back to the local commit before I used git pull.
What is the right way to get around this issue and merge with the latest changes on the master branch? Would one use git --rebase in this case?
Try
git stash
git pull origin master
And once it updates, git stash apply to reapply your local changes
Since nobody has stated this clearly yet: You ask
What is the right way to get around this issue and merge with the latest changes on the master branch?
When you do git pull that does merge the remote changes into your current branch. Whether you would choose to do a rebase instead of a merge (per your other question) is a separate issue, but the default behavior is to combine the two sets of changes (local and remote).
More precisely, by default git pull does a fetch followed by a merge. The exact merge operation depends on configuration and on command-line options, but in a typical configuration where origin/master is upstream of master, saying
git pull
will merge origin/master into master.
So why the errors?
One possibility is that there were merge conflicts. If that happens, git will tell you. If you say git status in this condition, it will tell you that there's a merge in progress and it will indicate which paths (files) need conflict resolution.
Another possibility is that the changes don't conflict (in that they don't affect the same region of the same file) but still don't work properly together. That you would simply have to debug.

how to pull changes from master branch into another branch (this branch created from master previously) in the root in git-tfs

I have two branch in git-tfs. one is master and other is QA, this branch is created from master previously. All the recent changes are in master. Now i want to get the changes from master to my QA branch. how to get that? I want to get done that from the browser.
If you are talking the git-tfs command tool, you could also manager merges with git-tfs.
If you want, for example, to merge the branch b1 in the trunk
trunk, you need that b1 and trunk to be entirely checked in
Tfs. Once done, you could do the merge with git as a normal merge
with 2 local git branches. Then you have to check this commit into
Tfs with the command rcheckin and a merge changeset will be created
into Tfs.
More details please refer this tutorial git-tfs ,but it's not able to do this from the browser.
If you are just talking about the GIT source control in TFS, and want to get done that from the browser. The only way is creating a pull request. Detail step just follow this thread: Create a pull request
You will just have to synchronise the branch with the master and it will do, i.e in easier terms synchronisation of a branch means to merge the master into that branch. That's it!

Git: Merge test repository into master repository

I am new to Git/Heroku/RoR, know basics of these technologies.
I have a git repository repoA which has two branches, master and feature.
I continued working on repoA/feature and upon completion, because the changes were huge so decided to launch a separate app on Heroku to test them first.
So deployed repoA/feature to repoTest/feature on Heroku. Then made some fixes to the feature and finalized the code in repoTest/feature.
Another developer made some commits in repoA/master during this time.
Now I want to make my repoTest/feature LIVE and MERGE it to repoA/master.
Please help me how can I do that ?
NOTE: I have tried doing git rebase master but that did nothing even after a long manual conflict resolve exercise.
As below steps are my normally operations:
1. git checkout repoA/feature
2. git fetch repoTest/feature; git merge repoTest/feature repoA/feature; git stash
3. git checkout repoA/master; git pull origin
4. git checkout repoA/feature; git rebase repoA/master (maybe here you should resolve your conflicts); git stash pop
5. git status; git commit -am ""; git push origin

Git-Tfs: Pull a TFS changeset into existing git repository

I've got a git repository that was migrated from a TFS repository. There is currently no link between the repositories.
If I use git tfs list-remote-branches {http://...TFSRepo}, I can see the branches in TFS.
What I want to do is be able to pull a TFS changeset into my current git repository -- preferably as a commit, but I'd take just pulling the changes into the current branch.
quick-clone doesn't do what I need as it creates a new git repository (buried in my existing git repository...)
Is is possible to perform a pull of a single TFS changeset using the git-tfs extensions?
There is no way to pull only one changeset in an existing git repository that is not a git-tfs repository.
But you've got 2 possibilities to achieve your goal...
The first is to do a quick-clone in a new repository and then add this repository has a remote and fetch the commit you want.
The second is more tricky, less sure to work because you must understand how git-tfs works.
Amend the last commit to add at the end of the commit message something like that:
git-tfs-id: [https://tfs.codeplex.com:443/tfs/TFS16]$/valtechgittfs/BugMerge;C31467
with :
git-tfs-id: [https://url.tfs.server:/tfs/TeamCollection]$/ProjectName/BranchName;CchangesetId
where you specify as the changeset id, the one of the last changeset before the one you want to fetch. Then, if you have at least the v0.20 of git-tfs, then, fetch changesets...

Resources