I
I
ivan_kholodov2021-04-26 12:11:52
git
ivan_kholodov, 2021-04-26 12:11:52

How to find out the relevance of the current branch through the script?

How can I know (not through the console) whether the current branch is up to date or not?

There is a script in which I can pull out the name of the current branch from the config. The base branch is known ( master).

For example, the current branch test-rebase.
Basic master.

How to correctly refer to git to get true/false(updated test-rebasefrom masteror not)?

Is this possible?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
Lynn "Coffee Man", 2021-04-26
@Lynn

https://git-scm.com/docs/git-merge-base
git merge-base --is-ancestor <commit> <commit>
Something like this?

if git merge-base --is-ancestor master test-rebase; then
  echo merged
else
  echo Not merged
fi

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question