Difference between revisions of "GIT client"

Line 7: Line 7:
 
* Help page: http://git-scm.com/book/en/  
 
* Help page: http://git-scm.com/book/en/  
 
* GitHub wiki page: https://help.github.com/articles/set-up-git/
 
* GitHub wiki page: https://help.github.com/articles/set-up-git/
 +
 +
 +
* '''very good tutorial''': http://rogerdudler.github.io/git-guide/
  
  
Line 68: Line 71:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 +
 +
 +
=Update files=
  
 
* Check files status
 
* Check files status
Line 74: Line 80:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 +
 +
* Update files on local HEAD
 +
<syntaxhighlight lang="bash">
 +
git pull
 +
</syntaxhighlight>
 +
 +
 +
 +
=Commit files=
  
 
* Add file
 
* Add file
Line 84: Line 99:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
git commit -m "my comment"
 
git commit -m "my comment"
 +
</syntaxhighlight>
 +
 +
 +
* Send changes to the server
 +
<syntaxhighlight lang="bash">
 +
git push
 
</syntaxhighlight>
 
</syntaxhighlight>
  

Revision as of 22:03, 29 October 2014


References



Installation

apt-get install libcurl4-gnutls-dev libexpat1-dev gettext libz-dev libssl-dev
apt-get install git git-doc git-gui


If you want to use GIT as your local SVN client:

apt-get install git-svn


If you want to browse the GIT repository in a local browser:

apt-get install gitweb


Configuration

Run the following commands a standard user, not root!

git config --global user.name "guillaume.diaz"
git config --global user.email johndoe@example.com
git config --global core.editor vim


Register SSH key

If you'd like to register a SSH key to use with GIT, see the excellent GitHub documentation: https://help.github.com/articles/generating-ssh-keys/


Get project files

Run the following commands a standard user, not root!


  • Clone an existing project
git clone [url] [targetFolder]

Note that you can use HTTPS, SSH or SVN URLs.


  • Perform operation using Git GUI
cd [my GIT repo]
git gui


Update files

  • Check files status
git status


  • Update files on local HEAD
git pull


Commit files

  • Add file
git add [file]


  • Commit
git commit -m "my comment"


  • Send changes to the server
git push


Ignore files in GIT

Create a file called .gitignore to the root of your GIT repo.

cd [my GIT repo]
vim .gitignore


Insert the following code:

## generic files to ignore
*~
*.lock
*.DS_Store
*.swp
*.out
*.tmp
*.temp
build/

#java specific
*.class
target/

#maven
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
release.properties

#netbeans ignore personal stuff 
nbproject/private/

#eclipse specifics
settings/
.project
.classpath
.checkstyle


You can find more example on https://github.com/github/gitignore