Last Updated: February 25, 2016
·
540
· rajadain

git reget

I work with a number of different versions of a core product at Performance Systems Development, each of which is tailored or configured for a client. In order to debug a client version, I have to checkout a vanilla copy of the core at a specific tag or branch, apply client configurations and then run it. For this I frequently have to clean the checkout of all customization, reset to core product, pull the latest copy and checkout a particular branch or tag.

To accomplish this, I made a git alias named reget.

Usage

$ git reget <branch_name or tag_name>

Example

$ git reget 2.14

Definition

Add this line to your .gitconfig under [alias], usually found in the home directory:

[alias]
    reget = !"git reset --hard HEAD && git clean -fxd && git pull && git checkout"

Installation

As an alternative to adding the line manually to .gitconfig, you can run the following command on the prompt to achieve the same thing:

$ git config --global alias.reget '!git reset --hard HEAD && git clean -fxd && git pull && git checkout'