If you're interested in the arcane side of Git and GitHub, you might also be interested in the follow-up talk I've given a few times the last half-year or so, which details a bunch of other new things: http://zachholman.com/talk/more-git-and-github-secrets/
> Adding `#L52` to the end of a code file URL will highlight that line number.
You can click the line number (in the column to the left of the code) to add the fragment to the URL, and Shift+click to select a range. Easier than editing the URL directly.
If you have already checked that all unstaged changes should get included in the commit with `git st`, then i think doing `git ac` makes sense.
I would, however, use `add -u` instead of `add .`, but that's mostly because i'm messy and its not unusual for me to have some local files which i don't want to commit -- e.g., one-off scripts, temporary SQL dumps, etc. YMMV.
One that's missing that I've found rather useful: add ".pibb" to the end of any Gist URL to get the "HTML Only" version suitable for embedding in any other site. Time was, before a lot of blogging engines had GitHub integration, this was the best way to get code on your blog.
Interesting, I like the "git status -sb" (short, show branch tracking info) command. The query one seems a lot like "git grep" to me, I am not sure I understand the difference.
The specified "git ac" alias (git add . && git commit) is bad news, in my book. I've seen people accidentally commit extra files using "git add ." .
I much prefer "git add -p" for tracked files; the git tab completion for the shell seems to be pretty good about picking up untracked files using "git add <TAB>" as well. (https://github.com/git/git/tree/master/contrib/completion)
> The query one seems a lot like "git grep" to me, I am not sure I understand the difference.
1. shows only the most recent matching commit
2. git grep is essentially `grep` customised to the working copy (by default), you probably mean git log --grep
3. `:/foo` is actually a general revisions specifier, see third from bottom in section SPECIFYING REVISIONS of gitrevisions(7), so you should be able to use it anywhere you need to specify a revision (not that I can see much use for it outside of log and show at the moment)
Annotating the start of a new bulk of work or a new feature. Documenting when you make changes to the project that aren't code related, e.g. "Now using GitHub for issue tracking, closes #1". Communicating with people using your repo, e.g. "Merry Christmas y'all, I'm away for three weeks, if you have any questions please contact Jim".
I'm not saying doing any of these things is good practice but they are use-cases for when an empty commit might make sense.
Gists are an easy way to work with small bits of code without creating a fully fledged repo
What is the disadvantage of working with a "fully fledged repo"? Gists unecessarily fragment git workflows. For example, how do I convert my work (a git repo like all projects) into a gist? gists should have been designed as an alternative way of viewing repos, not as a slightly different species of repo.
In the U.S. keyboard layout, you have to press Shift-/ to type ‘?’. Listing Shift is a good reminder for those people, who are the majority of readers.
Something also to know is there are multiple ways to embed images in wiki pages. There's the standard Markdown syntax, but there's also a syntax that allows things like specifying the height or width of the image. Example:
Read the code diff to see if it’s a good change you want to make to your project. If you can’t tell from just the diff, you can add their fork as a Git remote and check out their branch so you can run/test/preview your project with their proposed changes.
If you like their work, just click “Merge pull request”. Your repo on GitHub will be updated. Then you can pull from your GitHub repo to your local repo to make sure you’re working on the version of the code including their changes. If you want, also post a comment in the pull request thanking the contributor.
If you don’t like their work, post a comment saying why you don’t want to pull. If they just have small style problems, or the feature has a bug in it or is missing docs, describe what’s wrong or what still needs to be added or decided. You and other contributors might end up discussing what else needs to be added, using comments. The creator of the pull request can update the code in their branch at any time to accommodate feedback. At the point that their code is good enough, just click “Merge pull request”.
If the pull request is something that can’t be salvaged – it’s out of scope for the project or you think it is an anti-feature – explain that in a comment, and close the pull request at the same time. Pull requests can always be closed or reopened later, and can be commented on whatever state they’re in, so the closed state is mainly for communicating whether you expect that you will eventually merge that pull request or a later update of it.
[+] [-] holman|12 years ago|reply
If you're interested in the arcane side of Git and GitHub, you might also be interested in the follow-up talk I've given a few times the last half-year or so, which details a bunch of other new things: http://zachholman.com/talk/more-git-and-github-secrets/
I'm more of a fan of the second talk, myself. My favorite thing I discovered while making the second talk was the "second-order-diff Git trick", which Tom Moertel came up with here: http://blog.moertel.com/posts/2013-02-18-git-second-order-di...
[+] [-] CyberShadow|12 years ago|reply
You can click the line number (in the column to the left of the code) to add the fragment to the URL, and Shift+click to select a range. Easier than editing the URL directly.
[+] [-] roryokane|12 years ago|reply
[+] [-] daGrevis|12 years ago|reply
[+] [-] conradev|12 years ago|reply
[+] [-] epidemian|12 years ago|reply
I would, however, use `add -u` instead of `add .`, but that's mostly because i'm messy and its not unusual for me to have some local files which i don't want to commit -- e.g., one-off scripts, temporary SQL dumps, etc. YMMV.
[+] [-] jballanc|12 years ago|reply
[+] [-] rafal_chmiel|12 years ago|reply
[+] [-] unknown|12 years ago|reply
[deleted]
[+] [-] canadev|12 years ago|reply
The specified "git ac" alias (git add . && git commit) is bad news, in my book. I've seen people accidentally commit extra files using "git add ." .
I much prefer "git add -p" for tracked files; the git tab completion for the shell seems to be pretty good about picking up untracked files using "git add <TAB>" as well. (https://github.com/git/git/tree/master/contrib/completion)
[+] [-] masklinn|12 years ago|reply
1. shows only the most recent matching commit
2. git grep is essentially `grep` customised to the working copy (by default), you probably mean git log --grep
3. `:/foo` is actually a general revisions specifier, see third from bottom in section SPECIFYING REVISIONS of gitrevisions(7), so you should be able to use it anywhere you need to specify a revision (not that I can see much use for it outside of log and show at the moment)
[+] [-] lubomir|12 years ago|reply
[+] [-] davej|12 years ago|reply
I'm not saying doing any of these things is good practice but they are use-cases for when an empty commit might make sense.
[+] [-] daGrevis|12 years ago|reply
[+] [-] epidemian|12 years ago|reply
Edit: sorry, i was thinking about --allow-empty-message, not --allow empty.
[+] [-] nahname|12 years ago|reply
[+] [-] raju|12 years ago|reply
I have a git alias for the same -
Note: That's not my blog.[+] [-] Myrmornis|12 years ago|reply
What is the disadvantage of working with a "fully fledged repo"? Gists unecessarily fragment git workflows. For example, how do I convert my work (a git repo like all projects) into a gist? gists should have been designed as an alternative way of viewing repos, not as a slightly different species of repo.
[+] [-] sampo|12 years ago|reply
Actually just ? suffices.
Source: the list of shortcuts shown by typing ? on a GitHub page.
[+] [-] delluminatus|12 years ago|reply
[+] [-] roryokane|12 years ago|reply
[+] [-] lelandbatey|12 years ago|reply
[+] [-] rafal_chmiel|12 years ago|reply
[+] [-] jdkanani|12 years ago|reply
[+] [-] roryokane|12 years ago|reply
git-instaweb instantly configures and launches a webserver running gitweb (which is built into Git).
gitweb (http://git-scm.com/docs/gitweb) is a “Git web interface (web frontend to Git repositories)”. It lets you browse commits, branches, etc.
[+] [-] davej|12 years ago|reply
[+] [-] perlgeek|12 years ago|reply
[+] [-] krebby|12 years ago|reply
[+] [-] thisisblurry|12 years ago|reply
[+] [-] mrfusion|12 years ago|reply
Any time my project gets one I panic :-(
[+] [-] roryokane|12 years ago|reply
If you like their work, just click “Merge pull request”. Your repo on GitHub will be updated. Then you can pull from your GitHub repo to your local repo to make sure you’re working on the version of the code including their changes. If you want, also post a comment in the pull request thanking the contributor.
If you don’t like their work, post a comment saying why you don’t want to pull. If they just have small style problems, or the feature has a bug in it or is missing docs, describe what’s wrong or what still needs to be added or decided. You and other contributors might end up discussing what else needs to be added, using comments. The creator of the pull request can update the code in their branch at any time to accommodate feedback. At the point that their code is good enough, just click “Merge pull request”.
If the pull request is something that can’t be salvaged – it’s out of scope for the project or you think it is an anti-feature – explain that in a comment, and close the pull request at the same time. Pull requests can always be closed or reopened later, and can be commented on whatever state they’re in, so the closed state is mainly for communicating whether you expect that you will eventually merge that pull request or a later update of it.
[+] [-] ozh|12 years ago|reply
- fetching locally: easy to test on your dev box
- without committing: easy to see what files are changed in your directory, and to diff files on your dev box
[+] [-] nroose|12 years ago|reply
[+] [-] iancarroll|12 years ago|reply