Created
May 27, 2021 14:10
-
-
Save theamanbhargava/ef51f593659c816454406d6d48de81f7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| try { | |
| if(Boolean(childProcess | |
| .execSync("git rev-parse --is-inside-work-tree 2>/dev/null") | |
| .toString()) | |
| ) { | |
| branchName = childProcess | |
| .execSync('git ls-remote --heads origin | grep $(git rev-parse HEAD) | cut -d / -f 3 | head -1') | |
| .toString(); | |
| } else { | |
| branchName = null | |
| } | |
| } catch (e){ | |
| console.log("couldn't get branch name from git object, check if this is a git branch") | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment