Talk:Git

From ArchWiki
Jump to: navigation, search

Smart HTTP

Trying to follow the instructions to set up HTTP access, I ran into following issue:

error: Cannot access URL http://<server>/git/example/, return code 22
fatal: git-http-push failed

Acccording to http://dev.bazingaweb.fr/2011/02/23/how-to-set-up-git-over-http.html the config file on the remote repository needs to get a couple new lines:

[http]
   receivepack = true

After this little change it all works for me.
-- User:Gunnar 4 May 2012

Git prompt

I've tried the method explained here to add git status and features to a zsh prompt, but to no avail.

The method explained here to add git status and features to a zsh prompt did not work in my case.

A stackoverflow answer [1] worked well for me. Here is what I added to my .zshrc:

setopt prompt_subst
autoload -Uz vcs_info
zstyle ':vcs_info:*' actionformats \
    '%F{5}(%f%s%F{5})%F{3}-%F{5}[%F{2}%b%F{3}|%F{1}%a%F{5}]%f '
zstyle ':vcs_info:*' formats       \
    '%F{5}(%f%s%F{5})%F{3}-%F{5}[%F{2}%b%F{5}]%f '
zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{3}%r'
zstyle ':vcs_info:*' enable git cvs svn
vcs_info_wrapper() {
  vcs_info
  if [ -n "$vcs_info_msg_0_" ]; then
    echo "%{$fg[grey]%}${vcs_info_msg_0_}%{$reset_color%}$del"
  fi
}
RPROMPT=$'$(vcs_info_wrapper)'

Has anyone else had a similar issue? If so, I'll update the page to match this fix. Qguv (talk) 00:09, 4 August 2013 (UTC)

By the way, git-prompt.sh is included two times in git: in usr/share/git/completion/git-prompt.sh and usr/share/git/git-prompt.sh.
IMHO, usr/share/git/completion/git-prompt.sh can be removed, because it has nothing to do with command line completion.
Frank (talk) 17:15, 21 February 2014 (UTC)

Exposition seems lacking

I used Git some years ago and was trying to refresh my memory by reading this article. I found it difficult to understand, although I don't know enough about Git to make the necessary edits here. For instance, under "Basic usage", I'm not really sure what a branch is, and especially, although it says "Create a branch to make changes", I don't know whether I actually need to make a new branch to make changes. How is "Merge commits back into the main branch" different from "Push changes to a remote server"? Under "Local repository", when I run "git init", what is that doing? I think it creates a .git directory but this could be explained a bit - what is it for, what does it contain. Next there is reference to an "index" or "staging area" - does this reside in .git? If so, perhaps we could mention that "git add" puts a copy of the specified files into somewhere in .git... Soon there is a reference to HEAD without explaining what HEAD is, but it seems important. Similarly "git mv" and "git ls-files" could have just a sentence explaining their difference to ordinary "mv" and "ls"... nothing huge, just a little context. Of course perhaps the problem is that I should read a tutorial (such as http://gitref.org/?) before reading the wiki article, but in that case it's a bit confusing that the wiki article has a style which at first seems introductory. Should we link to something like http://gitref.org/ at the top of the article? Herodotus (talk) 01:17, 16 July 2015 (UTC)

(of course I would absolutely prefer for the Arch Wiki to have a superior Git Tutorial to anyone else) Herodotus (talk) 01:24, 16 July 2015 (UTC)
The upstream docs are highly detailed, well explained, and offer everything from basic introductions to specialized use cases. This wiki page can not (and should not) compete here. As such, I'd suggest to remove most of the article, only referring to the relevant documentation. -- Alad (talk) 11:14, 16 July 2015 (UTC)
Perhaps there could eventually be another Arch Wiki article with such a tutorial. I would be disinclined to make a rule like "no tutorials on the Arch Wiki". I also disagree about the Git documentation being well explained, I think there's too much of it to choose from, and that it tends not to answer basic questions at the beginning, and I think that a Wiki article has the potential to remedy both problems. Do Arch Wiki articles just explain installation and basic setup, plus tips and tricks? Theoretically the Wiki page could explain stuff like the fact that Git keeps a local copy of the revision history, unlike CVS etc.; that Git is snapshot-based, while Darcs is patch-based; that there is a specially-designed structure in ./.git which supports certain operations efficiently; but I rarely see this kind of overview on Arch Wiki articles, so maybe it is not encouraged or supported. Herodotus (talk) 17:24, 16 July 2015 (UTC)
There is already a rule: Help:Style#Hypertext_metaphor. That in no way implies there sould be "no tutorials on Arch Wiki", or that you should restrict yourself to installation+tips. What it does imply is what I said above - use the upstream documentation where possible. Simply copy/pasting a few commands for TL;DR purposes doesn't cut it.
If you think there's too much too choose from, you can amend that with an introductory structure to the manuals in question; for an unrelated article but similar principle, see Midnight Commander. -- Alad (talk) 12:50, 17 July 2015 (UTC)
Hi Alad, sorry for the long delay in replying. I felt I should fix this article and brush up on Git at the same time, so I put it off for a while. Thanks for the link to the style guide and the example. It sounds to me like we're pretty much in agreement, generally speaking, about Arch Wiki policy. I thought about removing the tutorial stuff from the Git article but I didn't have the heart to do that. I felt it would make the article less useful to me. Instead, I fixed the problems that I had encountered (as a new user) with the existing tutorial, by adding new information. I hope I didn't make it too much longer: here are the changes I made. I welcome constructive criticism... Please note that I have looked at quite a few existing tutorials, and none of them are as helpful to me as the present state of this article. It now answers a number of (what I felt to be) obvious questions, such as the purpose of "git mv" and the location of the "index". These answers were not in any other tutorial, and I had to resort to Google and Stackexchange to find them. However, it would be awkward to keep this useful information in the article without the existing tutorial structure. Herodotus (talk) 08:26, 1 September 2015 (UTC)
I also came to this conclusion. Not only are the terms like "label", "index", "working tree", etc. really obscure, but just judging from the quite poor diversity of people doing changes (kind of like the Help articles), the whole thing seems so fat and filled that it would at least do good to do some re-ordering and sub-heading. First and foremost, I'd definitely like to see a better Git briefing and an explanation of the terms in the beginning of the article. Avoiding extra wording should, of course, be a consistent rule. It's not simplicity to explain any one thing in 4, albeit simple, different sentences. —Dettalk 13:06, 2 March 2016 (UTC)
I think we all have different ideas of how this article should be best organized... In my view we should turn this into a real tutorial that starts a repo from scratch and adds 2 or 3 files and does simple stuff with them, explaining committing, branching etc. along the way, with brief explanations and links to the upstream docs for details. Then a second similar tutorial could be made to clone a repo and participate to an existing project, avoiding to restate what was already said in the first tutorial. — Kynikos (talk) 03:14, 3 March 2016 (UTC)
+1. I'm all good with that. It would definitely make the thing more useful and easier to follow. —Dettalk 08:54, 3 March 2016 (UTC)
Except we're duplicating efforts with git-scm - which is already superior in every way - just to cater to users who want a "short-cut" to the topic in question. None of the changes so far have convinced me otherwise (and git-scm keeps improving as well: see [2]). If we must keep this page, we should use it for strictly Arch-related content (perhaps a short AUR workflow) and rope to use upstream documentation if needed. -- Alad (talk) 22:15, 5 March 2016 (UTC)
But that still sounds very similar to what Kynikos wants. A workflow with links to upstream for details. And maybe a big fat note in the beginning of the article. --Dettalk 11:43, 6 March 2016 (UTC)
Okay, I guess we should start making drafts to clearly convey our intents for the article. :) -- Alad (talk) 15:10, 6 March 2016 (UTC)
I've met people who thought that git is a front-end for Github. They were wrong, git is a front-end for AUR :P Lahwaacz (talk) 15:25, 6 March 2016 (UTC)
So now that we have this behind us, I think that's another vote for a general article? --Dettalk 05:47, 7 March 2016 (UTC)
Lol, that's something that we should put at the start of the article before the intro:
"I've met people who thought that git is a front-end for Github. They were wrong, git is a front-end for AUR." — Linus T.
Kynikos (talk) 03:20, 10 March 2016 (UTC)
+1 on adding that. I'm serious, a bit of humor (cf. Creating packages for other distributions) doesn't hurt. :P -- Alad (talk) 04:17, 10 March 2016 (UTC)
Linus T.? --Dettalk 11:11, 12 March 2016 (UTC)
@Det: I thought that signature was what would have made the joke more complete, but apparently it's not so easy to get... ^^'
It's up to Lahwaacz to add it or not, since he's the original author, or if he doesn't want to, with his permission I'll add it to my draft for the revised article, when I get to prepare it: I'm pretty sure that somebody with little sense of humor will soon remove it however, and when that happens I won't insist further by undoing the removal, it will just stay in the history of the page as another of this wiki's Easter eggs ;)
Kynikos (talk) 14:35, 15 March 2016 (UTC)
Well, if the draft is going to be released on April 1, then I would probably agree :P Otherwise, Det was right. -- Lahwaacz (talk) 15:51, 15 March 2016 (UTC)
Heh: [3] I hope it will last until April 2th :P -- Alad (talk) 01:38, 31 March 2016 (UTC)
Uh, now I fully understand your Machiavellian plans behind the creation of Template:Quote XD — Kynikos (talk) 04:12, 31 March 2016 (UTC)

Draft policy

By the way, is there an official policy for the formula of drafts, as per e.g.: Talk:Arch User Repository#Draft? --Dettalk 22:10, 9 March 2016 (UTC)

Not that I remember, but I think the best thing to do in this case would be to create it in a new page under one's own User page, and then link to it from here. — Kynikos (talk) 04:08, 10 March 2016 (UTC)
Ok. Whose? --Dettalk 18:05, 14 May 2016 (UTC)
Something like User:Det/Git will do ^^ — Kynikos (talk) 04:37, 15 May 2016 (UTC)
Something like that..? --Dettalk 05:12, 15 May 2016 (UTC)
Well, yes, I think you could just keep it simple and use the whole page for the draft, with only a Template:Expansion at the top if you want to link back to this talk page, but anyway you can organize it the way you want. — Kynikos (talk) 06:29, 15 May 2016 (UTC)
So then we should have at least two pages? Unless your suggestion really is the same as Alad's? --Dettalk 06:32, 15 May 2016 (UTC)
As I said, it's totally up to you; if I were you and wanted to attempt to implement both solutions separately, I'd create two different pages, e.g. User:Det/Git (tutorial) and User:Det/Git (AUR). Or, you can indeed try to merge both ideas into one, just be creative! — Kynikos (talk) 06:59, 15 May 2016 (UTC)