• Stars
    star
    134
  • Rank 270,967 (Top 6 %)
  • Language
    Java
  • License
    MIT License
  • Created about 5 years ago
  • Updated about 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Probably the sharpest git repository organizer & rebase/merge workflow automation tool you've ever seen

Git Machete IntelliJ Plugin

CircleCI JetBrains Plugins Downloads License: MIT

πŸ’ͺ Git Machete plugin is a robust tool that simplifies your git related workflow. It's a great complement to the JetBrains products' built-in version control system.

πŸ¦… The bird's eye view provided by Git Machete makes merges/rebases/push/pulls hassle-free even when multiple branches are present in the repository (master/develop, your topic branches, teammate's branches checked out for review, etc.).

πŸ‘ A look at a Git Machete tab gives an instant answer to the questions:

  • What branches are in this repository?
  • What is going to be merged (or rebased/pushed/pulled) and to what?

sample status with master, develop and a few topic branches

🎯 With this plugin, you can maintain small, focused, easy-to-review pull requests with little effort.

βš™ It is compatible with all JetBrains products (IntelliJ IDEA, PyCharm, Android Studio etc.). The latest plugin version is available for IDE versions from 2022.2 onwards.
Earlier plugin versions (which might not have all the latest features & fixes) are available for earlier IDE versions as well, starting from as early as 2020.1.

πŸ–₯ For the console version, check git-machete.

Installing from JetBrains Marketplace

This plugin is available on JetBrains Marketplace.
To install this plugin go to File > Settings > Plugins (Preferences/Settings > Plugins on macOS) in your IDE, then make sure you are on Marketplace tab (not Installed), in search box type Git Machete and click Install.
After installation, depending on the IDE version, the restart may be required. In that case, just click Restart IDE and confirm that action in a message box.

Where to find the plugin tab

Git Machete IntelliJ Plugin is available under the Git tool window in the Git Machete tab. You can find the Git tool window in the lower left corner of the screen.
You can also use Ctrl + Alt + Shift + M (⌘βŒ₯⇧M or ^βŒ₯⇧M on macOS) shortcut to open it.

Getting started with Git Machete

The examples below show a few common situations where Git Machete proves exceptionally useful.

If you are a Git Master or have used the git-machete CLI already, you may want to jump directly to the features.

Scenario 1: Review

Let's start with a very common case of review. Suppose that you work on two branches: sticky-header and fancy-footer (you've split your work among these two branches to keep the PRs small and easily reviewable).

In the meantime, a teammate of yours requested a review of their PR for branch common-scripts...

Git Machete allows you to check out the remote branch with Slide In. Alternatively, you could check out it via git CLI or Git Branches widget in IntelliJ. Once the review is complete, you can simply check out any other branch from the right-click menu or by a double click β€” master in the example.

Once the branch common-scripts is no longer needed for review, it can be slid out (Slide Out) β€” deleted from the branch layout and optionally the branch can be removed from the local repository.

Scenario 2: Branch update

Some time passed and your teammate has merged the common-scripts before you managed to merge your branches. You are supposed to update master and your branches now.

Firstly, you can fetch all changes from the remote using Fetch All.
As you'd expect, your local master is behind its remote, so you perform Pull to get it in sync. Note that the pull via Git Machete plugin does not require checking out the given branch.

The edge between master and sticky-header turned red. It means that there are some commits belonging to the parent (master) branch that are not reachable from the child (sticky-header). In case of master, these commits came from the recently merged common-scripts.

To put sticky-header back in sync to master two options are available β€” Checkout and Sync to Parent by Rebase ... or Checkout and Sync to Parent by Merge ... Fortunately, there are no conflicts to resolve.
Once sticky-header is rebased or merged, you can do the same for fancy-footer.

You may want to update the remotes as well. To do so, perform Push... for both of the branches. The push can be done even for a branch that is not currently checked out. Note that force push is required (as you have rebased the branches since the latest push).

After the rebases and pushes, all of your branches are back in sync β€” both to their parents and to their remotes.

Scenario 3: Commit to parent branch (sequential branch setup)

A review of your sticky-header has been done and all you've applied and committed all the fixes.
Git Machete shows that sticky-header is ahead of its remote. Furthermore, the edge between sticky-header and fancy-footer is red. The solution to this situation will not differ much from the previous scenario...

You can start with Checkout and Sync to Parent by Rebase... to place fancy-footer back on top of sticky-header. Now Push... both branches. Everything is back in sync again.

Scenario 4: Merge (maintaining linear history)

A PR for your sticky-header branch has been approved and is ready to merge.
To make git revert & git bisect easier and generally simplify diagnostics & providing fixes in production settings, let's stick to linear git history and thus perform merges that do not produce the actual merge commits.
The way to go is to fast-forward merge sticky-footer into master.

Note that Fast-forward Merge into Parent does not require you to check out the branch getting merged (or its parent) beforehand. You can perform it while some other branch is checked out β€” fancy-footer in our case.

Once the fast-forward merge is complete, the edge between master and sticky-header gets gray, which means that the latter has been merged.
master is now ahead of remote because of the commits from sticky-header. Since master hasn't diverged from its remote tracking branch, Push... does not require force.

You can now Slide Out the merged sticky-header branch. The remaining master and fancy-footer branches are now in sync.

Complete feature list

Please see the feature list for more specific feature description.

Build

Please see the development documentation for instructions on how to build this plugin on your own.

Issue reporting

If you see any bug or just would like to propose any new feature, feel free to create an issue.

When reporting a bug, it'd be very helpful for us if you could enable the IntelliJ logging on a DEBUG level, reproduce a bug and include the logs from IntelliJ in the issue.

Go to Help > Diagnostic Tools > Debug Log Settings and then paste the following line:

com.virtuslab

Then reproduce the bug and go to Help > Show Log in Files (Help > Show Log in Finder on macOS) to open the log file.

References

For additional background on what we believe are good practices take a look into our slides presentation. It explains our motivations and gives you an overview of main Git Machete objectives.

For more information about the plugin, see the teaser blog post and the complete feature list.

See also git-machete β€” a CLI version of this plugin.

More Repositories

1

git-machete

Probably the sharpest git repository organizer & rebase/merge workflow automation tool you've ever seen
Python
906
star
2

scala-cli

Scala CLI is a command-line tool to interact with the Scala language. It lets you compile, run, test, and package your Scala code (and more!)
Scala
544
star
3

graphbuddy

Graph Buddy helps you to understand the code better
HTML
149
star
4

render

Universal data-driven template for generating textual output, as a static binary and a library
Go
140
star
5

iskra

Typesafe wrapper for Apache Spark DataFrame API
Scala
136
star
6

besom

Besom - a Pulumi SDK for Scala. Also, incidentally, a broom made of twigs tied round a stick. Brooms and besoms are used for protection, to ward off evil spirits, and cleansing of ritual spaces.
Scala
124
star
7

pandas-stubs

Pandas type stubs. Helps you type-check your code.
Python
120
star
8

unicorn

Small Slick library for type-safe id handling
Scala
112
star
9

scala-yaml

Scala
92
star
10

Inkuire

Hoogle-like searches for Scala 3 and Kotlin
Scala
91
star
11

avocADO

Safe compile-time parallelization of for-comprehensions for Scala 3
Scala
87
star
12

jenkins-operator

Kubernetes native Jenkins Operator, moved to https://github.com/jenkinsci/kubernetes-operator
Go
82
star
13

bazel-steward

A bot to keep Bazel dependencies up to date
Kotlin
60
star
14

pretty-stacktraces

Scala
58
star
15

tetrisly-react

Tetrisly offers user-friendly components designed for effortless integration. Plus, it's fully compatible with Tetrisly for Figma with a seamless design and development experience in mind.
TypeScript
41
star
16

crypt

Universal cryptographic tool with AWS KMS, GCP KMS, GnuPG and Azure Key Vault support
Go
33
star
17

infrastructure-as-types

Infrastructure as Types - modern infrastructure declaration and deployment toolkit
Scala
26
star
18

ide-probe

Scala
26
star
19

beholder

Small slick lib for create views on on database
Scala
26
star
20

akka-serialization-helper

Serialization toolbox for Akka messages, events and persistent state that helps achieve compile-time guarantee on serializability. No more errors in the runtime!
Scala
26
star
21

activator-play-advanced-slick

Typesafe Activator template for advanced play-slick project
HTML
20
star
22

kubedrainer

Simple Kubernetes Node Drainer
Go
20
star
23

contextbuddy

Platform documentation
CSS
16
star
24

strapi-plugin-content-manager-extension-hierarchical

strapi-plugin-content-manager-extension-hierarchical
JavaScript
15
star
25

community-build3

Scala
14
star
26

scala-packager

Scala
13
star
27

pekko-serialization-helper

Serialization toolbox for Pekko messages, events and persistent state that helps achieve compile-time guarantee on serializability. No more errors in the runtime!
Scala
13
star
28

using_directives

Java
12
star
29

coursier-m1

A small repo to release coursier using self-hosted Mac M1 runner
Shell
11
star
30

vss

Scala
10
star
31

scg-cli

scg-cli is a CLI tool for Semantic Code Graph analysis
Scala
9
star
32

ReactSphere-reactive-beyond-hype

Repo for presentation on ReactSphere: Reactive beyond hype
HCL
8
star
33

akka-workshop-client

Base code for akka workshop.
Scala
8
star
34

scala-compose

Scala
7
star
35

scala.today

Scala
7
star
36

scala-snippet-checker

TypeScript
6
star
37

codetale

CodeTale - documentation & issue tracking
Dockerfile
6
star
38

genesis

Common sbt settings for sbt-based projects
Scala
5
star
39

pyspark-workshop

HTML
5
star
40

data_lake_navigation_atlas

Code for blogpost Navigation in the data lake using Atlas
Scala
5
star
41

ddd-public-materials

All public materials for community prepared by The DDD guild from Virtuslab
Kotlin
5
star
42

kleisli-examples

Examples from blog post on Kleisli arrows
Scala
5
star
43

tips

CSS
4
star
44

go-extended

Things missing or not belonging in the standard library
Go
3
star
45

mesos-on-vagrant

Just a Vagrant file and Ansible playbook for deploying Mesos cluster for testing
3
star
46

scala-workshop

Scala
3
star
47

talk-scala-akka-play

Introductory talk to Scala, Akka and Play! framework
JavaScript
3
star
48

base-types-kt

Library with common types for Kotlin supporting domain-driven functional programming
Kotlin
3
star
49

Edison-BlinkOnboard

Example Akka system for blinking LED at Intel Edison
Scala
3
star
50

jira-stats

Exports some metrics from jira via REST api - currently calculated dev days per ticket
Go
2
star
51

runscope-agent

Containerized Runscope Agent (Dockerfile)
Makefile
2
star
52

homebrew-cloud

This repository contains a collection of Homebrew formulas.
Ruby
2
star
53

scala-cli-packages

Shell
2
star
54

spark_sql_under_the_hood

Code for blogpost: Spark SQL under the hood
Scala
2
star
55

homebrew-scala-cli

Ruby
1
star
56

scalacamp

ScalaCamp.pl site source code
HTML
1
star
57

homebrew-git-machete

1
star
58

scala-workshop-bootstrap

Shell
1
star
59

gpki

Git Public Key Infrastructure
Python
1
star
60

jenkins-operator-assets

Hosting Jenkins Operator assests like images or CSS files.
CSS
1
star
61

virtusity-workshop-graphql

TypeScript
1
star
62

dokka-site

Kotlin
1
star
63

kibana-rpm-packaging

1
star
64

kubectl-deploy

Simple kubectl plugin for rendering and applying Kubernetes manifests
Go
1
star
65

akka-http-kubernetes.g8

Scala
1
star
66

scala-cli.g8

Scala
1
star
67

homebrew-scala-experimental

Ruby
1
star
68

scg-scala

Scala compiler plugin for Semantic Code Graph generation
Scala
1
star
69

ide-probe-tests

Scala
1
star
70

Ariadne-Bootloader

A little less unfinished TFTP bootloader for Arduino Leonardo Ethernet
Arduino
1
star
71

ScalaTastiesScrapper

Scala
1
star
72

scala3-workshop

Scala
1
star
73

aws-cli

Yet Another Dockerized AWS CLI
Makefile
1
star
74

besom-ask-me

Scala
1
star
75

shuttlecraft

Scala
1
star