summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Allen <michael@michaelallen.io>2015-08-25 14:27:36 +0100
committerMichael Allen <michael@michaelallen.io>2015-08-25 15:31:28 +0100
commit6c3c7f65c9497b603736ba32ba30571fcf1e9839 (patch)
tree692e684fb7925ce059b26a41bd51a8f1976931f8
parent6c0e6b44872d08b83a54e9f442551992b8d2b5a2 (diff)
downloadgit-sonar-6c3c7f65c9497b603736ba32ba30571fcf1e9839.tar.gz
git-sonar-6c3c7f65c9497b603736ba32ba30571fcf1e9839.zip
Added readme and license
Diffstat (limited to '')
-rw-r--r--LICENSE19
-rw-r--r--README.md122
-rwxr-xr-xgit-radar4
3 files changed, 143 insertions, 2 deletions
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..c3dddb4
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,19 @@
+Copyright (c) 2015 Michael Allen
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..090fea6
--- /dev/null
+++ b/README.md
@@ -0,0 +1,122 @@
+---
+
+# Git Radar
+
+A heads up display for git.
+
+## Installation
+
+Install from brew:
+
+```
+> brew install michaeldfallen/formula/git-radar
+```
+
+Then add to your prompt:
+
+*Bash*
+
+Add to your `.bashrc`
+```
+export PS1="$PS1$(git-radar --bash)"
+```
+
+*Zsh*
+
+Add to your `.zshrc`
+```
+export PROMPT="$PROMPT$(git-radar --zsh) "
+```
+
+## Features
+
+### Files status
+
+The prompt lists the file changes and whether they are staged, unstaged or
+untracked.
+
+Prompt | Meaning
+------------------------------------
+![git:(master) 3A] | We have 3 untracked files
+![git:(master) 2D2M] | We have 2 modifications and 2 deletions not yet staged to commit
+![git:(master) 1M1R] | We have 1 modification and a file renamed staged and ready to commit
+![git:(master) 1U] | We have a conflict caused by US that we need to address
+![git:(master) 1M 1D2M 2A] | A combination of the above types
+
+Each symbol represents a different change to a file. These are based on what git
+considers has happened to the file.
+
+Symbol | Meaning
+-----------------
+A | A new Added file
+D | A file has been Deleted
+M | A file has been Modified
+R | A file has been renamed
+C | A file has been copied
+U | A conflict caused by Us
+T | A conflict caused by Them
+B | A conflict caused by Both us and them
+
+The color tells you what stage the change is at.
+
+Color | Meaning
+-----------------
+Green | Staged and ready to be committed (i.e. you have done a `git add`)
+Red | Unstaged, you'll need to `git add` them before you can commit
+Grey | Untracked, these are new files git is unaware of
+Yellow | Conflicted, these need resolved before they can be committed
+
+### Local commits status
+
+The prompt will show you the difference in commits between your branch and the
+remote your branch is tracking. The examples below assume you are checked out on
+`master` and are tracking `origin/master`.
+
+Prompt | Meaning
+-----------------------------
+![git:(master 2↑)] | We have 2 commits to push up
+![git:(master 3↓)] | We have 3 commits to pull down
+![git:(master 3⇵5)] | Our version and origins version of `master` have diverged
+
+### Our branch against Master commits status
+
+The prompt will also show the difference between your branch on origin and what
+is on `origin/master`. This a is hard coded branch name which I intend to make
+configurable in the future.
+
+This is the difference between the commits you've pushed up and `origin/master`.
+
+Prompt | Meaning
+-------------------------------------------
+![git:(m ← 2 my-branch)] | We have 2 commits on `origin/my-branch` that aren't on `origin/master`
+![git:(m 4 → my-branch)] | There are 4 commits on `origin/master` that aren't on `origin/my-branch`
+![git:(m 1 ⇄ 2 my-branch)] | `origin/master` and `origin/my-branch` have diverged, we'll need to rebase or merge
+
+### (Optional) Auto-fetch repos
+
+Ensuring your refs are up to date I found can be a pain. To streamline this
+git-radar can be configured to auto-fetch your repo. When the `--fetch` flag is
+used git-radar will run `git fetch` asynchronously every 5 minutes.
+
+This will only occur when the prompt is rendered and it will only occur on the
+repo you are currently in.
+
+To use this feature, when setting your prompt, call git-radar with `--fetch`:
+
+*Bash*
+```
+export PS1="$PS1$(git-radar --bash --fetch)"
+```
+
+*Zsh*
+```
+export PROMPT="$PROMPT$(git-radar --zsh --fetch) "
+```
+
+## License
+
+Git Radar is licensed under the MIT license.
+
+See [LICENSE] for the full license text.
+
+[LICENSE]: https://github.com/michaeldfallen/git-radar/blob/master/LICENSE
diff --git a/git-radar b/git-radar
index 349d4f0..ebda515 100755
--- a/git-radar
+++ b/git-radar
@@ -50,14 +50,14 @@ if [[ -z $@ ]]; then
echo " --bash # Output prompt using Bash style color characters"
echo ""
echo "Bash example:"
- echo " export PS1=\"\\W\\\$(git-radar --bash --prompt) \""
+ echo " export PS1=\"\\W\\\$(git-radar --bash --fetch) \""
echo ""
echo " This will show your current directory and the full git-radar."
echo " As an added benefit, if you are in a repo, it will asynchronously"
echo " run \`git fetch\` every 5 mins, so that you are never out of date."
echo ""
echo "Zsh example:"
- echo " export PROMPT=\"%1/%\\\$(git-radar --zsh --prompt) \""
+ echo " export PROMPT=\"%1/%\\\$(git-radar --zsh --fetch) \""
echo ""
echo " Same as the Bash but for Zsh."
exit