Transcription

Version control: basic Git tutorialPreseted byVictoria Rudakova

What is "version control"Version control is a system that recordschanges to a file or set of files over timeso that you can recall specific versionslater

Git: the three states Commited (stored in local database) Modified (file changed but not commited to database) Staged (modified file is marked to go into the nextcommit snapshot)

Git installation Windows: http://www.git-scm.com Linux: apt-get install git yum install gitAlready installed in cygwin

Git config Using Git Bash (command line): git config --global user.name "Name Surname" git config --global user.email [email protected] Using Git GUI:

Getting git repository To clone existing repository from server2: git clone [email protected]:/usr/local/cryo3d/cryo3d.git To start version controlling edited existing (new) files (trackingand commiting to local repository): git add filename[start tracking new/edited filename] git add . (git add -A)[start tracking all changed/new files] git commit -m 'Commit message: what changes were introduced'[save changes to the local repository]

Recording changes to the repository

Recording changes to the repository(GUI version)

Recording changes to therepository: status git status[Check status of your project]

Recording changes to therepository: status git status[Check status of your project]

Recording changes to therepository: tracking your files git add(directory)][Begin tracking a new file

Recording changes to therepository: staging modified files git add[Stage the file, add thiscontent to the next commit]

Recording changes to therepository: ignoring files If we do not want to track automaticallygenerated files (e.g. Log files, build files etc).gitignore file

Viewing staged and unstagedchanges git diff[what changed but not yet staged]

Viewing staged and unstagedchanges - GUI

Recording changes to therepository: commiting your changes git committhe local repository][commit your changes to

Viewing the commit history git log

Working with remotes git fetch[fetch all the info you don'thave from remote repository, no automaticalmerging] git merge[automatically merge data fromremote with the your repository data] git pull[fetch and merge automatically]pull fetch merge git push origin masterto the server][push your version

Working with remotes - GUI

Pushing to already changed remote Git won't allow to push to the remote which isahead of your version: first need to fetch

To know more http://www.git-scm.com/book/en/v2