OVYA Git Bash Scritps
0.1.0
Useful git scritps and OVYA git workflow related scripts
|
Functions | |
oglGetBranch () | |
Return the current branch or detached ref. More... | |
oglGetDir () | |
Return the location of .git repo. More... | |
oglGetDivergenceStatus (string, string) | |
Return the branches divergence status. More... | |
oglGetRemoteBranches (string) | |
Return the remote branches if any, empty if no remote branches found. More... | |
oglGetStatus (string) | |
Return the git work tree status as concatenation by commas of the variables HAS_UNCOMMITTED_CHANGE and HAS_UNSTAGED_FILE. If the work tree is clean the output is the value of the variable IS_CLEAN. If the work tree is empty the output is comma separated of the variables IS_CLEAN and IS_EMPTY. More... | |
oglGetUpstreamBranch (string) | |
Return current upstream branch if any, empty if no upstream configured for the branch. More... | |
oglHasRemoteBranch (string) | |
Tests if the branch has a remote branch. More... | |
oglHasUncommittedChange (string) | |
Test if the work tree has uncommitted change(s). More... | |
oglHasUnstagedFile (string) | |
Test if the work tree has unstaged file(s). More... | |
oglHasUpstreamBranch (string) | |
Tests if the upstream branch is configured. More... | |
oglIsBranchExists (string) | |
Test if the branch exists. More... | |
oglIsBranchNeedUpdate (string, string) | |
Test if a branch need to be update regarding the upstream branch or the given branch. The branch "need to be update" when the branch is behind, has diverged. More... | |
oglIsBranchUpToDate (string, string) | |
Test if a branch is up-to-date regarding the upstream branch or the given branch. The branch "is up-to-date" when the branch is equal to the given tracking brach or if there is no tracking branch. More... | |
oglIsClean (string) | |
Test if the work tree is clean. Note that an empty work tree is considered clean. More... | |
oglSwitchToBranch (string) | |
Switch to the given branch if it's not the current branch. More... | |
oglIsValidRef () | |
Test if the given reference is valid in the local repository. The reference can be a commit hash, HEAD,u}, a branch name, a tag, etc. More... | |
oglGetBranch | ( | ) |
Return the current branch or detached ref.
string | echoed. |
oglGetDir | ( | ) |
Return the location of .git repo.
string | echoed. |
oglGetDivergenceStatus | ( | string | , |
string | |||
) |
Return the branches divergence status.
string | The branch A to operate on. If not set, use the current branch. |
string | The branch B to operate on. If not set : ⋅ use the upstream branch tracked by A is configured ; ⋅ else use the remote branch of origin/A if exists ; ⋅ else return the value of $IS_NOT_TRACKING. |
string | One of the value of the global variable IS_EQUAL, IS_AHEAD, IS_BEHIND, HAS_DIVERGED, INVALID_LOCAL_REF, IS_NOT_TRACKING, IS_NOT_APPLICABLE. |
oglGetRemoteBranches | ( | string | ) |
Return the remote branches if any, empty if no remote branches found.
string | Branch to operate on. Current branch if not set. |
0 | if remote branch found. |
1 | if remote branch not found. |
oglGetStatus | ( | string | ) |
Return the git work tree status as concatenation by commas of the variables HAS_UNCOMMITTED_CHANGE and HAS_UNSTAGED_FILE. If the work tree is clean the output is the value of the variable IS_CLEAN. If the work tree is empty the output is comma separated of the variables IS_CLEAN and IS_EMPTY.
string | The optional branch to operate on (current branch if not set). |
0 | if the status can be found |
1 | if the status can not be found (branch does not exist, …) |
oglGetUpstreamBranch | ( | string | ) |
Return current upstream branch if any, empty if no upstream configured for the branch.
string | Branch to operate on. Current branch if not set. |
0 | if upstream branch is configured |
1 | if upstream branch is NOT configured |
oglHasRemoteBranch | ( | string | ) |
Tests if the branch has a remote branch.
string | Branch to operate on. Current branch if not set. |
0 | if upstream branch is configured |
1 | if upstream branch is NOT configured |
oglHasUncommittedChange | ( | string | ) |
Test if the work tree has uncommitted change(s).
string | The optional branch to operate on (current branch if not set). |
0 | if has uncommitted file(s) |
1 | if not |
oglHasUnstagedFile | ( | string | ) |
Test if the work tree has unstaged file(s).
string | The optional branch to operate on (current branch if not set). |
0 | if has unstaged file(s) |
1 | if not |
oglHasUpstreamBranch | ( | string | ) |
Tests if the upstream branch is configured.
string | Branch to operate on. Current branch if not set. |
0 | if upstream branch is configured |
1 | if upstream branch is NOT configured |
oglIsBranchExists | ( | string | ) |
Test if the branch exists.
string | Branch to operate on. |
0 | if the branch exists |
1 | if the branch does not exist |
oglIsBranchNeedUpdate | ( | string | , |
string | |||
) |
Test if a branch need to be update regarding the upstream branch or the given branch. The branch "need to be update" when the branch is behind, has diverged.
string | The branch to operate on. If not set the current. |
string | The branch to operate on. If not set the upstream branch. |
0 | if need update |
1 | if NOT need update |
oglIsBranchUpToDate | ( | string | , |
string | |||
) |
Test if a branch is up-to-date regarding the upstream branch or the given branch. The branch "is up-to-date" when the branch is equal to the given tracking brach or if there is no tracking branch.
string | The branch to operate on. If not set the current. |
string | The branch to operate on. If not set the upstream branch. |
0 | if up-to-date |
1 | if NOT up-to-date |
oglIsClean | ( | string | ) |
Test if the work tree is clean. Note that an empty work tree is considered clean.
string | The optional branch to operate on (current branch if not set). |
0 | if clean |
1 | if not clean |
oglIsValidRef | ( | ) |
Test if the given reference is valid in the local repository. The reference can be a commit hash, HEAD,u}, a branch name, a tag, etc.
string | The ref to test. |
0 | if the ref exists |
1 | if the ref does not exist |
oglSwitchToBranch | ( | string | ) |
Switch to the given branch if it's not the current branch.
string | The branch to go. |
0 | if the switch is done |
1 | if the switch is failed |