How could I check if feature_branch and origin/feature_branch point to the same commit?
How could I check if feature_branch and origin/feature_branch point to the same commit?
Share
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.
You can compare the output of
git-rev-parse, such as in this bit of shell script:If you’re not interested in using this in a script, but just want some indication of where
feature_branchandorigin/feature_branchare relative to each other, then the top of the output ofgit statuswill tell you their relative positions if they are not the same, e.g.:However, note that this only works if your git config indicates that
origin/feature_branchis “upstream” forfeature_branch. If you’ve created the local branch from a pre-existing remote-tracking branch, this will typically be the case. If, instead,feature_branchwas a new branch you created locally, you can set up that association in your config by pushing the branch with-u, e.g.git push -u origin feature_branch.)