0

I am fairly new to bash scripting and I am trying to build a script to compare branches in 2 different repos in bitbucket.

currently, I have this code:

if [[ clone -eq 0 ]]; then cd ${1} echo " ******************************** CLONE SUCCESSFUL. ADDING $BB_COMPARE AS REMOTE REPO... ******************************** " add_remote=$(git remote add -f b $BB_COMPARE) echo " ************************************ UPDATING REMOTE ************************************ " git remote update echo " ************************************ CHECKING DIFFERENCE ************************************ " git_diff=$(git diff master remotes/b/master) fi if [[ git_diff -eq 0 ]]; then echo " ************************************ ERROR: $1 AND $compare are NOT in sync. ************************************ " 

I think git diff is what I am looking for, but I might be wrong.

1 Answer 1

1

I normally do this counting lines.... even with status, because you don't know how big it would be:

lines=$( git diff --name-only master remotes/b/master | wc -l ) if [ $lines -gt 0 ]; then echo "There are differences" fi 
Sign up to request clarification or add additional context in comments.

1 Comment

Why not git diff -q?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.