Live data from Hacker News

Git Tips And Workflows

durdn.com

11–20 of 40 posts

Re: Git Tips And Workflows

#11

I was not aware of the `git config` option for wrapping long files, worth the price of admission just for that for me. Edit: there's a `git diff` tip in there, but this comes up a few times so if anyone needs to do patches from git for svn repos do `git patch --prefix=none $DIFF1 $DIFF2 > some.patch` share and apply with `patch -p0 < some.patch`.

Rather than setting git's pager to less with options, just export the "LESS" environment variable with options you want less to use everywhere.

Re: Git Tips And Workflows

#12
Has anybody seen a "git for people who have no idea how to use git" tutorial?

I use git for keeping track of some personal projects, but the extent to which I understand how to use it is:

"git commit origin master"

We had a hackathon this weekend, and our team had three people on it. I wanted to make it so that they could also commit code into the same repo (I think this it the right term?), but had absolutely no idea how to actually make this happen, and googling didn't seem to give answers that were geared towards somebody with my level-of-understanding of git.

Re: Git Tips And Workflows

#13
post #12

Has anybody seen a "git for people who have no idea how to use git" tutorial? I use git for keeping track of some personal projects, but the extent to which I understand how to use it is: "git commit origin master" We had a hackathon this weekend, and our team had three people on it. I wanted to make it so that they could also commit code into the same repo (I think this it the right term?), but had absolutely no ide…

http://rogerdudler.github.com/git-guide/

And use

Github for a repo, if you want private, get out your CC and pay them a very small amount.

For printable

http://rogerdudler.github.com/git-guide/files/git_cheat_shee...

Re: Git Tips And Workflows

#15
post #12

Has anybody seen a "git for people who have no idea how to use git" tutorial? I use git for keeping track of some personal projects, but the extent to which I understand how to use it is: "git commit origin master" We had a hackathon this weekend, and our team had three people on it. I wanted to make it so that they could also commit code into the same repo (I think this it the right term?), but had absolutely no ide…

There is always:

http://try.github.com

For an interactive tutorial on adding files and the like. It gives a pretty file-centric view of the whole operation though... I'm working on a branch-centric tutorial here:

http://petercottle.com/gitGraph/src/index.html?demo

But it's not done yet (levels in the works)

Re: Git Tips And Workflows

#16
post #13
post #12

Has anybody seen a "git for people who have no idea how to use git" tutorial? I use git for keeping track of some personal projects, but the extent to which I understand how to use it is: "git commit origin master" We had a hackathon this weekend, and our team had three people on it. I wanted to make it so that they could also commit code into the same repo (I think this it the right term?), but had absolutely no ide…

http://rogerdudler.github.com/git-guide/ And use Github for a repo, if you want private, get out your CC and pay them a very small amount. For printable http://rogerdudler.github.com/git-guide/files/git_cheat_shee...

Or just use bitbucket for free private repos up to teams of 5.

Re: Git Tips And Workflows

#17
post #12

Has anybody seen a "git for people who have no idea how to use git" tutorial? I use git for keeping track of some personal projects, but the extent to which I understand how to use it is: "git commit origin master" We had a hackathon this weekend, and our team had three people on it. I wanted to make it so that they could also commit code into the same repo (I think this it the right term?), but had absolutely no ide…

Read ProGit: http://git-scm.com/book

> "git commit origin master"

That's not how to do it :)

> I wanted to make it so that they could also commit code into the same repo

No. Each developer works in her private repo, for sharing work you use a bare repo people push to / fetch from.

Re: Git Tips And Workflows

#18
post #17
post #12

Has anybody seen a "git for people who have no idea how to use git" tutorial? I use git for keeping track of some personal projects, but the extent to which I understand how to use it is: "git commit origin master" We had a hackathon this weekend, and our team had three people on it. I wanted to make it so that they could also commit code into the same repo (I think this it the right term?), but had absolutely no ide…

Read ProGit: http://git-scm.com/book > "git commit origin master" That's not how to do it :) > I wanted to make it so that they could also commit code into the same repo No. Each developer works in her private repo, for sharing work you use a bare repo people push to / fetch from.

>No. Each developer works in her private repo, for sharing work you use a bare repo people push to / fetch from

What do you mean by a "bare repo"? blhack wants to make it so that they commit code into the same repo. You could do that by setting up a repository somewhere, and then each person would clone it.

Re: Git Tips And Workflows

#19
post #12

Has anybody seen a "git for people who have no idea how to use git" tutorial? I use git for keeping track of some personal projects, but the extent to which I understand how to use it is: "git commit origin master" We had a hackathon this weekend, and our team had three people on it. I wanted to make it so that they could also commit code into the same repo (I think this it the right term?), but had absolutely no ide…

It depends on whether you have used other version control before.

If you jump straight to using git in production , you'll experience a lot of "git anxiety" every time you run a command that you're not quite sure what it will do.

There's always the git book. http://git-scm.com/book

Realistically git isn't something that you can just pick up on an ad-hoc basis.

Best way is just to make a folder, fill it with some random text files and type "git init". Then you can practise, just make changes to files. Try branching and merging, try rebasing some commits to a different branch, try cherry picking from one branch to another. Make sure you get some practise in merging conflicting changes because that comes up annoyingly often in the real world (so pick a merge tool that you are comfortable using since git will plug in to a few but the default one is not the most friendly).

You can learn it pretty well from one machine, but it might help to setup a github and use another machine (or VM) to practise the "distributed" part (understanding origin/master etc).

Don't necessarily worry about learning everything from the get go, I have used it for about a year and there's still plenty of features I haven't ever had to use but make sure you understand what you think you understand.

When you are learning you'll find stuff will happen which wasn't what you expected, at this point you can start googling and will probably end up on a stack overflow page that will answer your question succinctly.

There will be times when you think you have broken everything, you probably haven't. At this point git log and git reset are your friends.

Re: Git Tips And Workflows

#20
> Search for a string in all revisions of entire git history

The example they show can be shortened by using xargs:

    git rev-list --all | xargs -n1 git --no-pager grep -F "search string"
And here it is as an alias that you can add to your .gitconfig:

    grepall = "!f() { git rev-list --all | xargs -n1 git --no-pager grep -F \"$1\"; }; f"
Post reply on HN