arielf / clean-push Goto Github PK
View Code? Open in Web Editor NEWA bash script implementing a git-flow to produce safe, neat, rebased + sqashed PRs
License: MIT License
A bash script implementing a git-flow to produce safe, neat, rebased + sqashed PRs
License: MIT License
Hi, this looks promising. It would be nice to have a few quick examples of how to use it. I presume I clone this repo and maybe copy the two files clean-push and 4-way-diff into my repo? Then call them via sh clean-push
on the command line. I can, and will figure it out, but it would be nice if you just spoon fed it to me :)
Thanks.
Example session where someone else merged a delta into main and my local dev already had that delta.
In this case we detect this a bit late (while on the temp-branch
doing the integration) and when we fail we remain there.
% ./clean-push
./clean-push: cool: repo is clean (fully committed)
Main branch: main
Feature branch: dev
Temporary branch: temp-branch
-----------------------------------------------------------------
(1) Pull latest remote 'main' into local branches (main & dev)
(conflicts may be detected)
$ pull-main-branch-into main && pull-main-branch-into dev
Switched to branch 'main'
Your branch is up to date with 'origin/main'.
remote: Enumerating objects: 9, done.
remote: Counting objects: 100% (9/9), done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 5 (delta 2), reused 3 (delta 2), pack-reused 0
Unpacking objects: 100% (5/5), done.
From ssh://github.com/arielf/clean-push
* branch main -> FETCH_HEAD
0328273..9e3e8cc main -> origin/main
Updating 0328273..9e3e8cc
Fast-forward
4-way-diff | 3 +++
clean-push | 9 +++++++--
2 files changed, 10 insertions(+), 2 deletions(-)
Switched to branch 'dev'
Your branch is up to date with 'origin/dev'.
From ssh://github.com/arielf/clean-push
* branch main -> FETCH_HEAD
Updating fc6ab3f..9e3e8cc
Fast-forward
-----------------------------------------------------------------
(2) Create temporary work branch from 'main' -> 'temp-branch'
$ git checkout -b temp-branch main
Switched to a new branch 'temp-branch'
-----------------------------------------------------------------
(3) Merge + Squash delta from 'dev' (on pristine temp-branch branch)
(conflicts may be detected)
$ git merge --squash dev
(nothing to squash)Already up to date.
-----------------------------------------------------------------
(4) Commit on 'temp-branch': please edit/clean the commit message in your editor
Note: the final form of this commit message is _exactly_ how it
will appear in the pushed PR. First line will be subject/heading.
$ git commit
On branch temp-branch
Untracked files:
tryme
nothing added to commit but untracked files present
./clean-push: git commit FAILED: status=1
If we could detect the empty diff case at step (3) "Already up to date" which is not an error, we could recover more elegantly:
dev
branchtemp-branch
hi,
nice script, but it seems to assume remotes are at 'origin'. in my case I'm commonly using 'upstream' for example. it would be great if I could pass that alternative in somewhere.
A few actual usage examples in the readme would also be v helpful instead of needing to read the script to see what the options are.
Cheers.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.