Giter VIP home page Giter VIP logo

git-powershell-scripts's Introduction

Git Powershell Scripts

A collection of functions that makes using git from Powershell a lot faster

Rationale

Git is kind of silly. If I run git status Git tells me exactly what files I can stage using git add but I can't just tell git add to stage the second file in that list. I have to type in the entire path or come up with some clever search pattern.

This collection of functions for Powershell makes working with Git a little bit easier and a lot faster.

For example:

git-status and git-branch (notice the dashes) give you a numbered output

> git-status
0: M src/path/to/changed/file/foo.cs
1: M src/path/to/changed/file/bar.cs`

Which can be fed into functions suchs as git-add, git-checkout, git-merge, git-diff, git-reset,...

> git-add 1

Which stages the file src/path/to/changed/file/bar.cs without having to type in the entire path.

I've also written a few helper functions for rebasing and merging.

List of functions

Branch functions

git-branch numbered output of git branch

git-checkout $n check out numbered branch

git-merge $n merge numbered branch

File functions

git-status numbered output of git status

git-add $n stage numbered file

git-checkout-file $n checkout numbered file, if no argument is given discards all unstaged files (git checkout --.)

git-diff $n diff current changes to numbered file

git-diff-previous $n diff with previous version of numbered file

git-reset $n reset numbered file, if no argument is given unstages all staged changes (git reset)

Miscellaneous functions

git-cop $args check out a branch that matches the search pattern

git-rebase-onto $branch rebases current branch on the latest version of the target branch (target branch is pulled first)

git-merge-into $branch merges the current branch into the latest version of the target branch (target branch is pulled first)

Installation

Run the script using the dot syntax to make all functions available for the current Powershell session or add the following line to your $profile (run notepad $profile to edit your profile).

. "C:\path\to\repostiroy\git_tools.ps1"

git-powershell-scripts's People

Contributors

roy-t avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.