[Answers Andrej] Re: There's new GIT instructions on Github now

Jesse Phillips jessekphillips+D at gmail.com
Fri May 20 18:31:40 PDT 2011


Andrej Mitrovic Wrote:

> What the duck has happened to this topic?
> 
> Ok anyway, I found out a few things:
> 
> I can change $HOME by adding this line into C:\Program
> Files\Git\etc\profile file:
> HOME="/d/dev/git/"
> 
> right *above* this line:
> HOME="$(cd "$HOME" ; pwd)"
> 
> This was from someone's blogs post. And then if I want to start git
> bash from a different initial directory I just change the git bash
> shortcut "Start In" field to whatever directory.

Pretty sure you can just add HOME as an environment variable in the system settings thing that Windows provides somewhere.

> Anyways I've made a bunch of commits to my forked repo of dpl.org, and
> now have to figure out how to make a pull request. I haven't made any
> branches or anything because I'm way too new to this.

Branching is extremely easy in Git and can generally be the first thing you do before making any changes.

create new branch (branchName) and checkout (commits go into this branch)
git checkout -b branchName

switch to another branch (master)
git checkout master

> I would also like to know how to uncommit a change which hasn't been
> pushed yet. So if I locally do:
> git add someFile.d
> git commit -m "woops wrong comment"

You can amend a commit which will allow you to add no items or change the comment

git commit --amend

> I'd like to just uncommit that message. I couldn't find an easy way to
> do this. Isn't this just hg revert on mercurial? I had to resort to
> backing up the files and re-fetching from the repo because git kept
> complaining about being "ahead" of changes. Damn complicated software
> that needs a book to operate it. :]

I actually don't remember the steps but I think it goes something like:

git checkout HEAD^
// Do something with git rebase
git commit

> Also I'd add the first time I tried using GIT GUI a few months ago it
> froze and crashed when I tried to do a simple clone.

Don't do that :P



More information about the Digitalmars-d mailing list