[dundee] Git Recap

Chad Wollenberg chad at linuxbasement.com
Fri Feb 29 12:51:58 GMT 2008


Wow that's rpetty awesome you guys are using git. I've toyed with it, but it
takes big brains. I've also been trying out Bazaar, which is Canonical's new
SVN. Great information, thanks for it!
Chad

On Fri, Feb 29, 2008 at 6:45 AM, Barry Carr <barry at benericht.co.uk> wrote:

> Hi Folks,
>
> Here are those Git commands I used last night:
>
> ** Create a repository:
>
>   git init
>
> if you want your repositories elsewhere set-up an environment variable
> called GIT_DIR
>
> ** Add files to repository:
>
>   git add *.pas *.py *.rb
>
> add will take multiple file masks and recurs down local sub dirs. Create a
> .gitignore file to create
> a list of file extensions that git should, well, ignore. One file mask per
> line
>
> ** To commit changes to a repository:
>
>   git commit -a
>
> this command will place you into git's default text editor for you to add
> a commit message. To
> change the default editor create a GIT_EDITOR environment variable that
> points to you favourite
> editor. e.g.: export GIT_EDITOR=/home/me/myeditor. Add the -m switch to
> write you commit message on
> the command line and skip the text editor stage.
>
> ** To revert a change, or got back to a previous version:
>
>   git reset --hard HEAD
>
> Here, HEAD means the last commit. You can count backwards from the current
> head by using the caret
> e.g.: git reset --hard HEAD^ will revert to HEAD -1; HEAD^^ = HEAD -2
> etc..
>
> ** To create a branch:
>
>   git branch MyNewBranch
>
> Remember, all that the above has done is create the branch and not move
> you on to it. To see a list
> of branches just use: git branch. An asterisk displayed next to a branch
> indicates the current
> branch. A branch called master is the default branch that git
> automatically creates when you create
> a repo
>
> ** To move on to a branch or change you current branch:
>
>   git checkout MyNewBranch
>
> ** To merge two branches:
>
>   git checkout master
>   git merge MyNewBranch
>
> ** To see if anything needs committing:
>
>   git status
>
> ** To see the differences between whats in the repo head and on disk:
>
>   git diff
>
> I think its possible to specify your own diff viewer, but I'm not sure how
> to do it.
>
> ** Other useful commands
>
>   git fsck
>
>   Will check the integrity of your repository
>
>   git gc --prune
>
>   Will tidy up your repository and compact so that it will take up less
> space on disk.
>
> Virtually all of these commands have additional switches that I've not
> explained. Full documentation
> can be found via Git's homepage:
>
>   http://git.or.cz/
>
> Enjoy
>
> Cheers
> Barry
>
> _______________________________________________
> dundee GNU/Linux Users Group mailing list
> dundee at lists.lug.org.uk  http://dundee.lug.org.uk
> https://mailman.lug.org.uk/mailman/listinfo/dundee
> Chat on IRC, #tlug on dundee.lug.org.uk
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.lug.org.uk/pipermail/dundee/attachments/20080229/11fbff4e/attachment.html


More information about the dundee mailing list