Reputation: 3071
I have a git workspace an I want to know if a change has already been present in it..I think checking via commit is the best way wow to know if an existing commit is already present in the workspace?any other ideas you have to check if a change is already present inthe workspace is great too...
Thanks
Upvotes: 0
Views: 208
Reputation: 971
Doing a git log
and grepping for the Change-Id is one way to do it, as mentioned in Brad's answer. The downside of that is that you will pick up any references to that Change-Id in commit messages, and they may not be the actual change you're looking for.
Instead, you can search for the commit's sha1 like this:
git log --format="%H" | grep 11111111222222223333333344444444
Replace 11111111222222223333333344444444
with the sha1 of your commit.
Upvotes: 0
Reputation: 48556
I don't know if or how Gerrit actually fits into this, but you can examine a commit with
git show COMMIT
If it tells you it can't find the commit, it doesn't exist.
Upvotes: 0
Reputation: 5532
Does the commit have a change-id? If so, I think the easiest answer is to use git log | grep $CHANGE_ID
. This will quickly let you know if that change-id is in your commit history.
The Gerrit web UI makes it easy to cherry-pick changes from the server to your workspace, so I can't think of a better approach using the original commit's SHA1.
Upvotes: 1