it there are some pending changes? I'm looking for something machine-friendly to include on a script
Git status
Yhea but: 1 is not machine-friendly 2 is kind of overkill (I need to check IF there are chenges not have a list of them) 3 is a porcelain command...
What's the script's purpose?
Check if you have changes if yes -> stash fetch pull If you had changes ->stash pop
Just use the "overkill" solution and make a 1/0 state out of it. Doesn't the return code differ?
Sorry what does "make a 1/0 state out of it" means? (English is not my first language)
True/false. Doesn't matter your original output is long
True but it also means that probably git will have to do more stuffs before giving me back the result (not that performance is a concern but if I can...)
>performance is not a concern Commit the existing solution and move on, go burn time on something else
So long, goodbye, had to do it for my own things. repoPath='/path/to/repository' # Optionally add --untracked-files=no if [[ $(git -C "${repoPath}" status --porcelain) ]]; then echo "Output present: Changes detected" else echo "No output: No changes" fi
Already done it thanks
Обсуждают сегодня