User:Timothee Flutre/Notebook/Postdoc/2012/08/14: Difference between revisions
From OpenWetWare
(→About Git: add tuto français) |
(→About Git: add link to gitk screenshots) |
||
(10 intermediate revisions by 2 users not shown) | |||
Line 2: | Line 2: | ||
|- | |- | ||
|style="background-color: #EEE"|[[Image:owwnotebook_icon.png|128px]]<span style="font-size:22px;"> Project name</span> | |style="background-color: #EEE"|[[Image:owwnotebook_icon.png|128px]]<span style="font-size:22px;"> Project name</span> | ||
|style="background-color: #F2F2F2" align="center"| | |style="background-color: #F2F2F2" align="center"|[[File:Report.png|frameless|link={{#sub:{{FULLPAGENAME}}|0|-11}}]][[{{#sub:{{FULLPAGENAME}}|0|-11}}|Main project page]]<br />{{#if:{{#lnpreventry:{{FULLPAGENAME}}}}|[[File:Resultset_previous.png|frameless|link={{#lnpreventry:{{FULLPAGENAME}}}}]][[{{#lnpreventry:{{FULLPAGENAME}}}}{{!}}Previous entry]] }}{{#if:{{#lnnextentry:{{FULLPAGENAME}}}}|[[{{#lnnextentry:{{FULLPAGENAME}}}}{{!}}Next entry]][[File:Resultset_next.png|frameless|link={{#lnnextentry:{{FULLPAGENAME}}}}]]}} | ||
|- | |- | ||
| colspan="2"| | | colspan="2"| | ||
Line 16: | Line 16: | ||
** official [http://git-scm.com/doc book] | ** official [http://git-scm.com/doc book] | ||
** [http://gitref.org/ quick ref], [http://www.ndpsoftware.com/git-cheatsheet.html cheatsheet] | ** [http://gitref.org/ quick ref], [http://www.ndpsoftware.com/git-cheatsheet.html cheatsheet] | ||
** [http://mrchlblng.me/2014/09/practical-git-introduction/ practical intro] | |||
** tutorial for [http://nyuccl.org/pages/GitTutorial/ scientists] (another by a [http://kbroman.github.io/github_tutorial/ geneticist]) | ** tutorial for [http://nyuccl.org/pages/GitTutorial/ scientists] (another by a [http://kbroman.github.io/github_tutorial/ geneticist]) | ||
** [http://gitready.com/ resources] depending on your level | ** [http://gitready.com/ resources] depending on your level | ||
** git from the [https://codewords.recurse.com/issues/two/git-from-the-inside-out inside-out] | |||
** make your repositories freely available online via [https://github.com/ github] (see its [https://help.github.com/ help pages] too) or [https://bitbucket.org/ bitbucket] | ** make your repositories freely available online via [https://github.com/ github] (see its [https://help.github.com/ help pages] too) or [https://bitbucket.org/ bitbucket] | ||
** ask questions on [http://stackoverflow.com/ stackoverflow] | ** ask questions on [http://stackoverflow.com/ stackoverflow] | ||
** manage your code, papers, talks, courses and even [http://www.wired.com/wiredenterprise/2013/06/cades-witty-headline-here/ books] with it! | ** manage your code, papers, talks, courses and even [http://www.wired.com/wiredenterprise/2013/06/cades-witty-headline-here/ books] with it! | ||
** [http://fr.openclassrooms.com/informatique/cours/gerez-vos-codes-source-avec-git tutoriel en français] | ** [http://fr.openclassrooms.com/informatique/cours/gerez-vos-codes-source-avec-git tutoriel en français] | ||
** a [http://nvie.com/posts/a-successful-git-branching-model/ branching model] | |||
** [https://lostechies.com/joshuaflanagan/2010/09/03/use-gitk-to-understand-git/ gitk screenshots] | |||
Line 31: | Line 35: | ||
* '''Tips''': | * '''Tips''': | ||
** undo uncommitted changes: <code>git checkout myfile.txt</code> | ** undo uncommitted changes: <code>git checkout myfile.txt</code>; [https://github.com/blog/2019-how-to-undo-almost-anything-with-git (much) more] on "undo" | ||
** split a big commit in several smaller commits: <code>git add -p myfile.txt</code> | ** split a big commit in several smaller commits: <code>git add -p myfile.txt</code> | ||
** usual config: <code>git config --global user.name 'Timothée Flutre'; git config --global user.email 'timflutre@gmail.com'; git config --global color.diff auto; git config --global color.status auto; git config --global color.branch auto; git config --global core.editor emacs; git config --global i18n.commitEncoding 'utf8'; git config --global i18n.logOutputEncoding 'utf8'</code> | ** usual config: <code>git config --global user.name 'Timothée Flutre'; git config --global user.email 'timflutre@gmail.com'; git config --global color.diff auto; git config --global color.status auto; git config --global color.branch auto; git config --global core.editor emacs; git config --global i18n.commitEncoding 'utf8'; git config --global i18n.logOutputEncoding 'utf8'; git config --global core.autocrlf input</code> | ||
** remote via ssh tunnel: first open the tunnel <code>ssh gateway.foo.bar -l tflutre -Nf -L 20400:maincluster:22</code>, then add the remote <code>git remote add mcl ssh://tflutre@localhost:20400/home/tflutre/myproject/.git</code> | ** remote via ssh tunnel: first open the tunnel <code>ssh gateway.foo.bar -l tflutre -Nf -L 20400:maincluster:22</code>, then add the remote <code>git remote add mcl ssh://tflutre@localhost:20400/home/tflutre/myproject/.git</code> | ||
** create release on github: first create tags, and then create the release (automatic via tag name) <code>curl --user "timflutre" --data '{"tag_name":"v1.0","target_commitish":"master","name":"v1.0","body":"first release"}' https://api.github.com/repos/timflutre/eqtlbma/releases</code> | ** create release on github: first create tags, and then create the release (automatic via tag name) <code>curl --user "timflutre" --data '{"tag_name":"v1.0","target_commitish":"master","name":"v1.0","body":"first release"}' https://api.github.com/repos/timflutre/eqtlbma/releases</code> | ||
** get download count of release: <code>curl -u "timflutre" -i https://api.github.com/repos/timflutre/eqtlbma/releases/:id/assets</code> where the release id can be obtained via <code>curl -u "timflutre" -i https://api.github.com/repos/timflutre/eqtlbma/releases/</code> | ** get download count of release: <code>curl -u "timflutre" -i https://api.github.com/repos/timflutre/eqtlbma/releases/:id/assets</code> where the release id can be obtained via <code>curl -u "timflutre" -i https://api.github.com/repos/timflutre/eqtlbma/releases/</code> | ||
** avoid being rejected by github because SSL certificates are not installed on your machine: add <code>export GIT_SSL_NO_VERIFY=true</code> to your <code>~/.bash_profile</code> ([http://stackoverflow.com/a/4454754/597069 source]) | |||
** make the [http://www.gnu.org/prep/standards/html_node/Change-Logs.html ChangeLog] file: <code>git log --no-merges --format="%an: %s" > ChangeLog</code> | |||
** collaborate with some using Windows: ask him to do <code>git config --global core.autocrlf true</code> | |||
Line 84: | Line 91: | ||
** then I add my repo from cluster1 as a remote: <code>cd myproject/; git remote add cluster1 ssh://tflutre@cluster1:/home/tflutre/myproject/.git</code> | ** then I add my repo from cluster1 as a remote: <code>cd myproject/; git remote add cluster1 ssh://tflutre@cluster1:/home/tflutre/myproject/.git</code> | ||
** finally I fetch the remotes and create a "dev" branch which tracks the one on cluster1: <code>git remote update; git checkout -b dev cluster1/dev</code> | ** finally I fetch the remotes and create a "dev" branch which tracks the one on cluster1: <code>git remote update; git checkout -b dev cluster1/dev</code> | ||
* '''Personal repositories''': for some small project, I am the only one working on them and I want to keep them confidential, so I have my own server in my home on a computer cluster (~/opt/git) | |||
** <code>mkdir ~/smallproject; cd ~/smallproject; echo "hello" > README; git init; git add README; git commit -m "first commit"; cd ..; git clone --bare smallproject/.git</code> | |||
** edit <code>smallproject.git/config</code> to only keep section <code>[core]</code> and, inside, set <code>bare = true</code> | |||
** <code>mkdir -p ~/cluster1; sshfs -oworkaround=rename me@cluster1: ~/cluster1; cp -r smallproject.git ~/cluster1/opt/git</code> | |||
** <code>cd ~/smallproject; git remote add origin ~/cluster1/opt/git/smallproject.git</code> | |||
** I can now push and pull from this minimal server | |||
<!-- ##### DO NOT edit below this line unless you know what you are doing. ##### --> | <!-- ##### DO NOT edit below this line unless you know what you are doing. ##### --> |
Latest revision as of 03:10, 23 November 2017
Project name | Main project page Previous entry Next entry |
About Git
all: main supp main: latex paper_main.tex bibtex paper_main latex paper_main.tex latex paper_main.tex pdflatex paper_main supp: latex paper_supplements.tex bibtex paper_supplements latex paper_supplements.tex latex paper_supplements.tex pdflatex paper_supplements clean: rm -f *~ *.aux *.dvi *.log *.pdf *.bbl *.blg *.toc
|