Giter VIP home page Giter VIP logo

git-clean-stale-local's People

Contributors

mbrehin avatar tdd avatar

Stargazers

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

Watchers

 avatar  avatar

git-clean-stale-local's Issues

Script doesn't know rebased branches have been merged

In some cases git will not know that a branch has been merged because your local version of the branch differs from the copy of the branch that was merged.

For example, let's say User A checked out Branch A, then User B checked out Branch A and rebased it to squash some of the commits into a larger commit, then User B merges Branch A into the default branch (let's say master) and deletes Branch A from your GitHub/GitLab repo. git on User A's machine doesn't think Branch A was merged into master because the commit SHA of the latest commit on User A's copy of Branch A doesn't match any of the commits that are now in master.

Unfortunately I'm not sure of a good way to fix this issue, short of adding a flag that would let you delete any branches without upstream counterparts (this would have the side effect of deleting local branches you haven't pushed yet, which isn't great).

Fails on macOS due to different syntax for sed

When I run the script on macOS, it fails with:

sed: illegal option -- -
usage: sed script [-Ealn] [-i extension] [file ...]
       sed [-Ealn] [-i extension] [-e script] ... [-f script_file] ... [file ...]
fatal: malformed object name

Could you maybe adopt it to macOS, as well?

Add `--not-merged` option

@tdd Do you think that would be too dangerous to avoid unmerged stale branches cleanup?

git clean-stale-local [-n|--dry-run] [-u|--not-merged]

Use remote name as parameter, default as origin

If our repository doesn't stick to the conventional origin remote or has many remote repositories, we are not able to stale clean branches for theses ones.

We should be able to use both:

git clean-stale-local [-n|--dry-run] (using origin as default) or git clean-stale-local [-n|--dry-run] <remote name>.

We may also consider adding a global option, targeting all remotes: git clean-stale-local [-n|--dry-run] [-a|--all]

Git doesn't have the correct default branch locally if you change the default branch in the remote

I got stuck on this for a bit so I figure this might be useful to someone.

Git will not automatically update your local repository's default branch if the remote's default branch changes. So, if you change your default branch from master to develop, any copies of the repo cloned prior to the change will think master is the default branch, while any copies after the change will think develop is the default branch. This can cause the script to offer differing results depending on the machine you're on.

Solution: git remote set-head origin -a will update the branch that git considers the origin/HEAD to match the current default branch in the origin remote.

Source: Stack Overflow

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.