Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Checkout a particular commit given a TFS changeset #563

Closed
chaitanyagurrapu opened this issue Mar 11, 2014 · 5 comments
Closed

Checkout a particular commit given a TFS changeset #563

chaitanyagurrapu opened this issue Mar 11, 2014 · 5 comments

Comments

@chaitanyagurrapu
Copy link

I am not sure if this feature already exists. I haven't been able to find it in the docs.

It would be nice if there was a parameter option that let us use the TFS changeset to check out our commits rather than the git SHA number.

For example, lets say someone reopens a bug that was supposedly fixed in change set 120006. It would be good if I do something like git tfs --changeset=12006 rather than doing git log --grep=C120006 to find the commit and then git checkout 01abe3

@sc68cal
Copy link
Contributor

sc68cal commented Mar 11, 2014

I assume you mean git tfs checkout --changeset=12006

@sc68cal
Copy link
Contributor

sc68cal commented Mar 11, 2014

Most of the time I'd prefer to not re-implement every piece of git porcelain, but I think this has a pretty well written use-case. If someone implemented it, I'd 👍 it.

@chaitanyagurrapu
Copy link
Author

For now I am simulating this functionality by adding the following function to my .bashrc file. It takes a tfs changeset number and checks it out to a new branch. Now I can just do gitcs 12006 and have a new branch called 12006 that is at changeset 12006. This function can also be modified to take the name of the branch as an optional parameter.

function gitcs() {
     local changeset=$(git log --grep=C$1 | grep commit | cut -c8-14);
     git checkout -b $1 $changeset;
}

pmiossec added a commit to pmiossec/git-tfs that referenced this issue Jun 21, 2014
git tfs checkout changesetId [-b=branch_name]
ex: git-tfs checkout 2365
      git-tfs checkout 2365 -b=bugfix_2365

Solve git-tfs#563
pmiossec added a commit to pmiossec/git-tfs that referenced this issue Jul 10, 2014
git tfs checkout changesetId [-b=branch_name]
ex: git-tfs checkout 2365
      git-tfs checkout 2365 -b=bugfix_2365

Solve git-tfs#563
pmiossec added a commit to pmiossec/git-tfs that referenced this issue Jul 10, 2014
git tfs checkout changesetId [-b=branch_name]
ex: git-tfs checkout 2365
      git-tfs checkout 2365 -b=bugfix_2365

Solve git-tfs#563
@fourpastmidnight
Copy link
Contributor

If a PR has been merged, then this issue should be closed. I've used the git tfs checkout command and it works great! For example, I wanted to pull in some commits on a clean branch prior to the commits I was interested in via cherry-picking (central source code control is so painful)...anyway, I was able to do the following:

git cherry-pick $(git tfind 21792)    # tfind is an alias for tfs checkout

which resulted in checking out the git commit associated with TFS C21792 and merging it into the current branch a'la cherry picking. Super useful; so thanks for the contribution!

@chaitanyagurrapu
Copy link
Author

Sounds good to me. Close it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants