Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c6fcd81155 | |||
| 5b99160266 | |||
| 38e71f6f9d | |||
| fa9b2a38b1 | |||
| d3f7a39b96 | |||
| bc874fa5bd | |||
| f0c9f902a4 | |||
| b9e145abdf |
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2017 Ivan Malopinsky
|
||||
|
||||
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.
|
||||
@@ -7,7 +7,7 @@ Keep your repo fresh with one command.
|
||||
```
|
||||
Usage: git fresh [-fmrtRW] [-sl] [remote] [root]
|
||||
By default, git-fresh will:
|
||||
- rebase against remote current branch
|
||||
- update local root (master) to match remote root
|
||||
- stash changes
|
||||
- prune remote branches
|
||||
|
||||
@@ -34,12 +34,17 @@ root: root branch, master by default
|
||||
|
||||
## Installation
|
||||
|
||||
### Manual
|
||||
### Manual on Linux or MacOSX
|
||||
|
||||
1. Clone or download
|
||||
2. `cd git-fresh`
|
||||
3. `sudo ./install`
|
||||
|
||||
### Manual on Windows
|
||||
|
||||
Copy the file [git-fresh](https://raw.githubusercontent.com/imsky/git-fresh/master/git-fresh) to `usr\bin` in your git installation directory.
|
||||
This usually is `C:\Program Files\Git\usr\bin`.
|
||||
|
||||
### Package
|
||||
|
||||
* [Homebrew](http://brew.sh/): `brew install git-fresh`
|
||||
|
||||
@@ -9,7 +9,7 @@ usage () {
|
||||
cat << EOD
|
||||
Usage: git fresh [-fmrtRW] [-sl] [remote] [root]
|
||||
By default, git-fresh will:
|
||||
- rebase against remote current branch
|
||||
- update local root (master) to match remote root
|
||||
- stash changes
|
||||
- prune remote branches
|
||||
|
||||
@@ -82,7 +82,7 @@ while getopts ":fmrtslRWTv" opt; do
|
||||
TEST=true
|
||||
;;
|
||||
v)
|
||||
VERSION=1.8.2
|
||||
VERSION=1.11.0
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
@@ -176,16 +176,10 @@ fi
|
||||
|
||||
if [[ $REMOTES = true ]]; then
|
||||
# Update remotes and prune stale remotes
|
||||
|
||||
git remote prune $REMOTE
|
||||
git remote update $REMOTE
|
||||
git remote prune $REMOTE
|
||||
|
||||
# If the current branch exists on the remote, rebase against it
|
||||
REMOTE_CURRENT=$(git ls-remote $REMOTE --heads 2> /dev/null | grep "heads/$CURRENT$" | cat)
|
||||
|
||||
if [[ ! -z "$REMOTE_CURRENT" ]]; then
|
||||
git rebase $REMOTE $CURRENT
|
||||
fi
|
||||
fi
|
||||
|
||||
# If we are not already on root branch, switch to root branch (master)
|
||||
@@ -200,16 +194,15 @@ if [[ $WIPE_WORKSPACE = true ]]; then
|
||||
git clean -dfx
|
||||
fi
|
||||
|
||||
# Reset root?
|
||||
|
||||
if [[ $REMOTES = true ]]; then
|
||||
|
||||
# Reset root?
|
||||
|
||||
if [[ $RESET_ROOT = true ]]; then
|
||||
git reset --hard $REMOTE/$ROOT
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ $REMOTES = true ]]; then
|
||||
git rebase -q $REMOTE/$ROOT
|
||||
git pull --quiet --ff-only $REMOTE $ROOT || say "Fast forward merge failed on $ROOT. You can reset local $ROOT by running git fresh -R."
|
||||
fi
|
||||
|
||||
# Compute stale branches
|
||||
@@ -318,4 +311,7 @@ if [[ ! -z $(git stash list | grep $STASH_STAMP | cat) ]]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
git gc --auto --prune=now
|
||||
if ! git gc --auto --force; then
|
||||
git prune
|
||||
rm -rf "$TOP_LEVEL_DIRECTORY/.git/gc.log"
|
||||
fi
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "git-fresh",
|
||||
"version": "1.10.0",
|
||||
"version": "1.11.0",
|
||||
"description": "Utility to keep Git repositories fresh",
|
||||
"global": true,
|
||||
"repo": "imsky/git-fresh",
|
||||
|
||||
Reference in New Issue
Block a user