Difference between revisions of "Git installation"

From relax wiki
Jump to navigation Jump to search
(Forced creation of a TOC - this will improve the formatting on the main page 'Did you know...' section.)
 
(29 intermediate revisions by 2 users not shown)
Line 1: Line 1:
== Git local repository varables ==
+
__TOC__
 +
 
 +
== Install ==
 +
Use [[msysgit]] for windows.
 +
 
 +
To install on linux, see here [http://git-scm.com/downloads git-scm.com].
 +
 
 +
To build newest version, for example 1.8.x on CentOS, see here [[git_build]].
 +
 
 +
== Git user/repository variables ==
 
This setup should provide a good framework
 
This setup should provide a good framework
 +
=== See config list ===
 +
git config --list
 +
 
=== Git setup commit information ===
 
=== Git setup commit information ===
 
Write in terminal
 
Write in terminal
  git config --add user.name "Your Name"
+
  git config --global --add user.name "Your Name"
  git config --add user.email you@example.com
+
  git config --global --add user.email you@example.com
  
 
It is recommended to install  [[EditPad Lite]], and use this as an commit message editor, so you won't have line ending mis-match in windows. Just save after writing the commmit message, and exit the program. The message is committed.
 
It is recommended to install  [[EditPad Lite]], and use this as an commit message editor, so you won't have line ending mis-match in windows. Just save after writing the commmit message, and exit the program. The message is committed.
 
  #Windows
 
  #Windows
  git config --add core.editor "EditPadLite7"
+
  git config --global --add core.editor "EditPadLite7"
 
  #Linux
 
  #Linux
  git config --add core.editor "nano"
+
  git config --global --add core.editor "nano"
  git config --add core.editor "gedit"
+
  git config --global --add core.editor "gedit"
  git config --add core.editor "vim"
+
  git config --global --add core.editor "vim"
  
 
  #Optional, if you want to synchronize to your github account
 
  #Optional, if you want to synchronize to your github account
  git config --add github.user GIT_USER_NAME
+
  git config --global --add github.user GIT_USER_NAME
 +
 
 +
=== Git aliases ===
 +
For creating shorter [http://davidwalsh.name/git-aliases Git aliases]
 +
git config --global alias.co checkout
 +
git config --global alias.br branch
 +
git config --global alias.com commit
 +
git config --global alias.stat "status -uno"
 +
 
 +
== Git local repository file settings ==
  
 
=== relax_commit.txt ===
 
=== relax_commit.txt ===
Write in "relax_commit.txt" from [[Format_commit_logs]].
+
Write in "relax_commit.txt", by getting template from [[Format_commit_logs]].
 
  git config --add commit.template "relax_commit.txt"
 
  git config --add commit.template "relax_commit.txt"
git add relax_commit.txt
 
git commit
 
 
commit message
 
<source lang="text">
 
Added default relax commit message.
 
</source>
 
 
# To see the commit message
 
git log
 
# If you would like to replace the last commit info
 
git commit --amend
 
  
 
=== .gitignore ===
 
=== .gitignore ===
Line 38: Line 47:
  
 
<source lang="text">
 
<source lang="text">
 +
# Git files
 +
relax_commit.txt
 +
.gitignore
 +
authors.txt
 +
relax_scripts
 +
*.patch
 +
 +
# From scons
 +
.sconsign.dblite
 +
.sconsign.tmp
 +
 +
# From building: scons api_manual_html
 +
docs/api/
 +
relaxc
 +
sconstructc
 +
 +
# From building: scons user_manual_pdf
 +
*.aux
 +
*.bbl
 +
*.blg
 +
*.dvi
 +
*.idx
 +
*.ilg
 +
*.ind
 +
*.lof
 +
*.lot
 +
*.out
 +
*.toc
 +
docs/latex/docstring.tex
 +
docs/latex/relax_version.tex
 +
docs/latex/script_definition.tex
 +
docs/latex/relax.pdf
 +
docs/relax.pdf
 +
 +
# From test_suite
 +
spin_
 +
 
# Compiled source #
 
# Compiled source #
 
###################
 
###################
*.com
 
*.class
 
*.dll
 
*.exe
 
*.o
 
*.so
 
 
*.pyc
 
*.pyc
*.py.swp
+
*.obj
 
+
*.exp
 +
*.lib
 +
*.pyd
 +
 
# Packages #
 
# Packages #
 
############
 
############
 
# it's better to unpack these files and commit the raw source
 
# it's better to unpack these files and commit the raw source
 
# git has its own built in compression methods
 
# git has its own built in compression methods
*.7z
 
*.dmg
 
 
*.gz
 
*.gz
*.iso
 
 
*.rar
 
*.rar
 
*.tar
 
*.tar
 
*.zip
 
*.zip
 
+
 
# Logs and databases #
 
# Logs and databases #
 
######################
 
######################
*.log
+
/docs/latex/*.log
*.sql
+
*.sqlite
 
 
 
 
# OS generated files #
 
# OS generated files #
 
######################
 
######################
Line 74: Line 112:
 
*~
 
*~
 
</source>
 
</source>
 
Check in the file
 
git add .gitignore
 
git commit
 
 
commit message
 
<source lang="text">
 
Added default git ignores
 
</source>
 
 
# To see the commit message
 
git log
 
# If you would like to replace the last commit info
 
git commit --amend
 
 
== .gitattributes ==
 
We want to always use [https://help.github.com/articles/dealing-with-line-endings linux line endings.]
 
Write in ".gitattributes"
 
# Declare files that will always have LF line endings on checkout.
 
#*.py text eol=lf
 
text eol=lf
 
 
git add .gitattributes
 
git commit
 
 
commit message
 
<source lang="text">
 
Added gitattributes to have LF line endings on checkout.
 
</source>
 
 
# To see the commit message
 
git log
 
# If you would like to replace the last commit info
 
git commit --amend
 
 
=== Re-normalizing the repository ===
 
Remove everything from the index.
 
git rm --cached -r .
 
Write both the index and working directory from git's database
 
git reset --hard
 
Prepare to make a commit by staging all the files that will get normalized. <br>
 
This is your chance to inspect which files were never normalized. You should
 
get lots of messages like: "warning: CRLF will be replaced by LF in file. <br>
 
git add relax_commit.txt
 
git add .gitignore
 
git add .gitattributes
 
 
Then Commit
 
git commit -m "Normalized line endings"
 
  
 
== See also ==
 
== See also ==
 
[[Category:Git]]
 
[[Category:Git]]

Latest revision as of 18:07, 19 October 2015

Install

Use msysgit for windows.

To install on linux, see here git-scm.com.

To build newest version, for example 1.8.x on CentOS, see here git_build.

Git user/repository variables

This setup should provide a good framework

See config list

git config --list

Git setup commit information

Write in terminal

git config --global --add user.name "Your Name"
git config --global --add user.email you@example.com

It is recommended to install EditPad Lite, and use this as an commit message editor, so you won't have line ending mis-match in windows. Just save after writing the commmit message, and exit the program. The message is committed.

#Windows
git config --global --add core.editor "EditPadLite7"
#Linux
git config --global --add core.editor "nano"
git config --global --add core.editor "gedit"
git config --global --add core.editor "vim"
#Optional, if you want to synchronize to your github account
git config --global --add github.user GIT_USER_NAME

Git aliases

For creating shorter Git aliases

git config --global alias.co checkout
git config --global alias.br branch
git config --global alias.com commit
git config --global alias.stat "status -uno"

Git local repository file settings

relax_commit.txt

Write in "relax_commit.txt", by getting template from Format_commit_logs.

git config --add commit.template "relax_commit.txt"

.gitignore

Consider placing a file .gitignore in the root of the repository.
It could contain this information

# Git files
relax_commit.txt
.gitignore
authors.txt
relax_scripts
*.patch
 
# From scons
.sconsign.dblite
.sconsign.tmp

# From building: scons api_manual_html
docs/api/
relaxc
sconstructc

# From building: scons user_manual_pdf
*.aux
*.bbl
*.blg
*.dvi
*.idx
*.ilg
*.ind
*.lof
*.lot
*.out
*.toc
docs/latex/docstring.tex
docs/latex/relax_version.tex
docs/latex/script_definition.tex
docs/latex/relax.pdf
docs/relax.pdf
 
# From test_suite
spin_
 
# Compiled source #
###################
*.pyc
*.obj
*.exp
*.lib
*.pyd
 
# Packages #
############
# it's better to unpack these files and commit the raw source
# git has its own built in compression methods
*.gz
*.rar
*.tar
*.zip
 
# Logs and databases #
######################
/docs/latex/*.log
 
# OS generated files #
######################
.DS_Store*
ehthumbs.db
Thumbs.db
*~

See also