11

I'm aware of the major functions that gist and github can offer even not an in-depth control of all commands.
Now I need to maintain some historical changes inot my git repository and What I'm lookin for is, Is there any automatic way (command) to push the git changes in some branch as a .diff into a gist file? Let's say I want to send a pull request in a gist file.
Actually I can get the .diff of some commit and copy paste the content into by-hand created gist file.

Any recommandations would be greately appreciated.
BR.

1 Answer 1

34

You can use one of the gist CLI clients. I can recommend the first one, written in Ruby.

  1. Install the gist CLI client:

    gem install gist
    

    For OS X, you can install even from Homebrew:

    brew install gist
    
  2. Associate it with your account (it doesn’t store your credentials, it just uses them to get an OAuth2 token):

    gist --login
    
  3. Then you can simply create a gist from command line, for example:

    git diff <commit>..<commit> | gist -f foo.diff
    

    and it will give you URL of the created gist.

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks @Jakub, you really pointed to what I'm actually looking for :)
This also preserves the coloring, which is hard to find.
Use git log to show the commit history and find the hashes to use in <commit>..<commit>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.