git-tools

Crates.iogit-tools
lib.rsgit-tools
version0.1.3
sourcesrc
created_at2020-10-17 11:51:04.629761
updated_at2021-08-04 12:56:49.483609
descriptionGit subcommands to help with your workflow.
homepagehttps://github.com/cecton/git-tools
repositoryhttps://github.com/cecton/git-tools
max_upload_size
id301317
size57,132
Cecile Tonglet (cecton)

documentation

README

Rust Latest Version License Docs.rs

Table of Contents
  • git delete

    Delete a local branch and its upstream branch altogether.

  • git fork

    Create a new branch based on the default branch (usually origin/main).

  • git push2

    Push a branch and set the upstream if not already set.

  • git try-merge

    Does like a git merge origin/main but helps you resolve the conflicting commits one by one instead than having to solve them altogether like git merge.

git-try-merge

Does like a git merge origin/main but helps you resolve the conflicting commits one by one instead than having to solve them altogether like git merge.

Synopsis

git try-merge
# 1.  Merge as many non-conflicting commits as possible under one merge commit
#     (if any)
# 2.  Merge the first conflicting commit alone
#     (if any)
#
# Then you need to repeat the command `git try-merge` until your branch is
# fully updated.
#
# The point: all the conflicting commits will be merged one-by-one which will
# allow you to fully understand the reason of the conflict and solve them
# separately. (A bit like `git rebase` would do.)

There is no real equivalent purely with Git's CLI. This is the closest:

git fetch
git merge origin/main
# Then you will solve all the conflicts of all the commits in one commit,
# no matter how many commits are conflicting.

Installation

cargo install git-tools --bin git-try-merge

git-fork

Create a new branch based on the default branch (usually origin/main).

Synopsis

git fork new-branch

# This command will:
#  -  make sure there is no uncommitted changes (clean state)
#  -  fetch (update) origin/main (or your default branch)
#  -  create a new branch "new-branch" that will be based on origin/main
#  -  checkout on this new branch

More or less equivalent to:

git checkout main
git pull --ff-only
git checkout -b new-branch

Implementation notes

The local branch main will not be updated. In fact, you don't even need a local branch main. The exact equivalent with Git would be more something like this:

git fetch origin main
# <ensure manually no uncommitted changes are pending>
git branch -f new-branch origin/main
git checkout new-branch

Installation

cargo install git-tools --bin git-fork

git-push2

Push a branch and set the upstream if not already set.

Synopsis

git push2

This is the equivalent of:

git push
# if it fails:
git push --set-upstream origin new-branch

Installation

cargo install git-tools --bin git-push2

git-delete

Delete a local branch and its upstream branch altogether.

Synopsis

git delete new-branch

This is the equivalent of:

git branch -d new-branch
git push origin :new-branch

Installation

cargo install git-tools --bin git-delete
Commit count: 80

cargo fmt