Skip to content
This repository was archived by the owner on Nov 25, 2022. It is now read-only.
This repository was archived by the owner on Nov 25, 2022. It is now read-only.

Add git move #52

@salcode

Description

@salcode

This tweet about committing to the wrong branch and then wanting to move those commits led to a thread, which culminated in

[alias]
	moveexisting = "!f() { MESSAGE=$(git log -1 HEAD --pretty=format:%s) && git reset HEAD~ --soft && git stash && git checkout $1 && git stash apply && git add . && git commit -m \"$MESSAGE\"; }; f"
	movenew = "!f() { git branch $1; git reset HEAD~1 --soft; git checkout $1; }; f"
	move = "!sh -c 'if [ `git rev-parse --verify "'$1'"` ]; then git moveexisting "'$1'"; else git movenew "'$1'"; fi'"

source

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions