When I use Git checkout master~X, I will get the Xth merged commit, what I really
want is the Xth real commit (not merged commits only).
How can I do that?
Thanks.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Try something like the following:
Change
--skip=2to the number of non-merge commits you want to skip over. If you want the first non-merge commit, use--skip=0; the second non-merge commit, use--skip=1; the third, use--skip=2; etc.You could set up an alias (using this answer as a guide):
Add
--globalto make it a global configuration change. Then you could just usegit co-non-merge X.