Git, questo sconosciuto

Data pubblicazione: 4-giu-2013 14.12.16

(Articolo di informatica pensato per i programmatori).

Git è un programma che serve a lavorare sul codice in modo condiviso.

Ecco cosa mi ha scritto Chris della Novell/SUSE...

Casella di testo

[...]

First create a repo:

 

Install git (There is git for nearly every OS on the planet) there is agood chance you can install it from your standard package manager. (apt, yum, zypper, ....)

 

the go to your project folder (a copy ? ) and run git init

This will create a .git folder in your project. Your project is now a git repo!

 

after that add the files to the repo:

git add * ( Adds the files to the repo)

git commit -a -m "initial commit" commits the (added files to the repo)

 

you now have all your content in a version repo! for more read the git book http://git-scm.com/book

 

Now sharing. This is only a bit more work.

 

Go to github.com (my favourite git repo provider) and get an account.

 

set up ssh keyless entry with github: https://help.github.com/articles/generating-ssh-keys

(I dont get the xclip bit either. just copy you pubkey and paste it to the form in the webpage)

 

create a repo on github.

https://help.github.com/articles/creating-a-new-repository

 

the add this remote repo to your local repo.

git remote add github git@github.com:yourname/easybashgui.git

 

you find this link in the repository page when you press the ssh button.

 

then do a git push github master and your files will be uploaded!

 

[...]

 

Cheers

Alcuni concetti sparsi...

1) in un terminale, con cd, => vai nella cartella del progetto...

2) git init ; git add * ; git commit -a -m "initial commit" ; git remote add github git@github.com:[user]/BashGui/easybashgui.git  # solo una volta giusto per iniziare...

(EDIT: ovviamente bisogna anche configurare la chiave SSH, l'ottima guida di GitHub la trovi qui adding-a-new-ssh-key-to-your-github-account )

(EDIT2: l'ultima volta non funzionava con [user] quindi ora -forse- l'ultimo comando è: 

 git remote add github git@github.com:BashGui/easybashgui.git 

oppure

 git remote add github git@github.com:vaisarger/bashkaraoke.git )

1) in un terminale, con cd, => vai nella cartella del progetto...

2) git pull github master # "pull" prende il repo remoto e lo porta IN LOCALE (si fa prima sempre questo, per includere le modifiche fatte da altri)

3) cambi il codice, fai miglioramenti, ecc.ecc.ecc.

4) git commit -a # serve a registrare in git le modifiche che hai fatto IN LOCALE...

5) git tag -a 8.0.0 -m "New 'git' EBG version!" # cambi versione IN LOCALE (facoltativo, se vuoi farlo)...

...e alla fine:

6) git push github master # "push" manda IN REMOTO le modifiche che hai fatto (se *non hai* cambiato la versione)...  ;-)

...oppure...

6) git push --tags github master # "push" manda IN REMOTO le modifiche che hai fatto (se *hai* cambiato la versione)...  ;-)



OK. Dopo 11 anni, un piccolo update...

E se ho sbagliato a pubblicare una release (con un tag) che magari ha errori nel codice, si può cancellare quella release/tag ?

Si. Ma devi farlo sia su Github (cioè in remoto), sia in locale (da terminale, sulla cartella del progetto nel tuo PC).