Giter Club home page Giter Club logo

git-fresh's Introduction

git-fresh ๐Ÿ‹

Keep your repo fresh with one command.

Usage

SYNOPSIS
  git-fresh [-fmrtRWS] [-sl] [remote] [root]

DESCRIPTION
  git-fresh helps keep your Git repo fresh.

  By default, git-fresh will:
  - update local root (master) to match remote root
  - stash changes
  - prune remote branches

  git-fresh will ignore any branches listed in a .freshignore file.
  .freshignore should contain branch names you would like to ignore
  on separate lines. The file can exist in the current Git repo
  or in the home directory, i.e. ~/.freshignore.

  remote is origin by default. root is master by default.

OPTIONS
  -f  Delete stale local and remote branches
  -m  Merge remote root into current branch
  -r  Rebase current branch against remote root
  -t  Remove local tags that do not exist on remote
  -R  Reset local root to remote root
  -W  Wipe workspace clean
  -S  Clear all stash entries

  -s  Apply stashed changes after run
  -l  Only delete local stale branches

  -v  Print git-fresh version and exit

Installation

Manual on Linux or macOS

  1. Clone or download
  2. cd git-fresh
  3. sudo ./install.sh

Manual on Windows

Copy the file git-fresh to usr\bin in your git installation directory. This usually is C:\Program Files\Git\usr\bin.

Package

License

git-fresh is provided under the MIT License.

Credits

git-fresh is a project by Ivan Malopinsky.

git-fresh's People

Contributors

bfontaine avatar hrshbh avatar hultberg avatar imsky avatar koppor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

git-fresh's Issues

Whitelist branches

I like the -f option but it deletes all the remote branches without asking. It would be great to have some whitelisting so I could keep the production branch but still use the -f option.

git fresh alters the last branch

git checkout -b something
git checkout master
git fresh
git checkout -

Unfortunately this will stay in the master instead of the something branch.

Sometimes throws a strange error

$ git fresh -f
Fetching origin
remote: Counting objects: 1, done.
remote: Total 1 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (1/1), done.
From github.***:***/***
   b5a9630..36fb856  master     -> origin/master
Fetching ***
Fetching ***
Fetching ***
Deleted branch *** (was b01d5c1).
Deleted branch *** (was a9f8bb3).
[git-fresh] Error on line 263: fi

No longer removing branches

Not sure if its isolated to me or now but i fresh no longer removes branches when i run it

running g fresh -f nets me

Fetching origin
Pruning origin
URL: https://github.com/wheniwork/{repo}
 * [pruned] origin/feature/update-deps
 * [pruned] origin/fix/fix-case
 * [pruned] origin/fix/fix-jenkins
Already on 'master'
Your branch is up-to-date with 'origin/master'.

when the following marked branches are merged.

g branch --list
  feature/add-devtool-docs < merged
  feature/add-pull-approve < merged
  feature/add-uploader-analytics
  feature/add-webpack-dashboard < merged
  feature/analytics-mk1 < merged
  feature/billing-react
  feature/de-ify-dependancies
  feature/invite-coworker
  feature/pending-coworkers
  feature/update-deps < merged
  feature/workchat-firebase-poc
  fix/correct-readme < merged
  fix/fix-case < merged
  fix/fix-jenkins < merged
* master
  react

Feature Request - Dry Run

It would be really nice to have a dry run parameter, which outputs the changes that would be made.

Run git prune when gc fails

[git-fresh] Local stale branches found: selenium-secondary-stateless
[git-fresh] Delete stale branches with: git fresh -f
Auto packing the repository in background for optimum performance.
See "git help gc" for manual housekeeping.
error: The last gc run reported the following. Please correct the root cause
and remove .git/gc.log.
Automatic cleanup will not be performed until the file is removed.

warning: There are too many unreachable loose objects; run 'git prune' to remove them.

[git-fresh] Error on line 321: git gc --auto --prune=now

seems one fix here is to detect if there are too many unreachable objects, and run git prune before gc

Running `git fresh -f` can leave untracked files

Given I run git fresh -f from a branch that has been merged it can leave untracked files in the working tree in some cases if they were deleted on the master branch in between the local version of master git fresh -f will sync and the yet to be synced remote version. This causes me to have to rm the untracked files afterwards which is easy to forget and might be swept up into a commit by an unsuspecting git noob.

Needs help docs

I love git fresh. I use it constantly, but the only way I notice flags that I don't use already is by looking at this repo directly. It would be amazing if there was a man page for it so that git help fresh or git fresh --help worked.

git fresh -f error

When running git fresh -f, I always get this error:

[git-fresh] Error on line 173: echo -n $LOCAL_STALE | tr " " "\0" | xargs -0 git branch -d 2> /dev/null

According to brew upgrade git-fresh, I'm using version 1.6.2.

Support for submodule update

I don't see in the source anywhere that you are handling git sub-modules. On some of my repos I need to pull and then run:

git submodule update --init --recursive

It would be great if you could do this as well.

Add option to remove only local stale branches

It would be nice to be able to remove stale branches, but only the local ones. My use case is I'm working in a large team, and there are a bunch of branches that while stale upstream, are not necessarily ones we want to remove without a discussion.

Change directory to repo root before making changes

if the user is in a directory on a branch that doesn't exist on master, they'll get a "no such file or directory" error while getting current working directory in the script.

the way this could work is:

  • detect repo root
  • save current dir
  • change dir to repo root
  • run fresh operations
  • change dir to previous current dir (if it exists)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.