Skip to content

Instantly share code, notes, and snippets.

@tfnico
Created October 26, 2012 11:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tfnico/3958248 to your computer and use it in GitHub Desktop.
Save tfnico/3958248 to your computer and use it in GitHub Desktop.
Sharing your uncommitted changes using git instaweb
On Wednesday, October 24, 2012 11:14:55 PM UTC+2, Joe Cabezas wrote:
hello!

i want to show uncommited changes using git instaweb, but instaweb only shows commited changes...

i just want to show the git diff output to someone easy..., there is any alternatives to git instaweb?, thank you

Interesting question. With a little trickery, you can get instaweb to do what you want.

Here's an example, I'll say I'm working on a repository ~/projects/gitblit

Step 1: Set up a temporary git repo to run instaweb and share your work-in-progress (WIP), and by that I mean your uncommitted changes:

cd ~/temp
git clone ~/projects/gitblit
cd gitblit
git config receive.denyCurrentBranch ignore #so we can push into this repo from our working repo
git instaweb

Now check that it's running properly on http://localhost:1234/

Step 2: Commit your working repo local changes into the sharing repo you just created, while leaving them intact in your working repo:

cd ~/projects/gitblit
# make some changes
git push -f ~/temp/gitblit master && GIT_DIR=~/temp/gitblit/.git git add -A && git commit -m "WIP"

Now check that there's a new commit called "WIP" on top in http://127.0.0.1:1234/?p=.git;a=summary

The one-liner above (you might consider saving it in a script of sorts) does the following:

  • git push -f.. this resets the shared/instaweb repo to have the same state as your working repo
  • Sets GIT_DIR to the shared repo, meaning it will be used for the next add/commit
  • Commits all your local changes (add/commit)

So, every time you want to share your current changes, just run the above one-liner (or script), and point people to the latest commit "WIP" in your instaweb.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment