On Github cursor-education / version-control-system-introduction-with-git-n-github
will be prepared to perform simple tasks using a version control system to learn more from other documents that may lack a high-level coneptual overview Mercurial (Hg), Git, and Subversion (SVN)
програма для роботи з інф що змінюється проблема: multiple developers кожен - редагує свою копію файлів, і вибирає шо розшарити з іншими проблема: декілька версій одного і того ж документа + історія плюс: ви зможете повернутися до певної версії пізніше плюс: локальні зміни одного не діють на інших в розробці - для збер сорсів (код, граф ресурси, )
copy to separate directory(project-25-12-2015, backup-qweqwe15, New Folder 283, ...) problems? weaknesses? milestones?
cons: copy-paste, speed, manual
problems? weaknesses? milestones?
single point of failure uploads is slow changes may break all merging is painful
Розподілена no network needed fast (since local)
is a database of all the edits to, and/or historical versions (snapshots) of your project.local repository and the central (remote) repository
your personal (local) copy of repository
action to copy a remote repository to your local
action, that you made to share your changes with other teammates. uploading your local changes to repository
a version of document
action, that you made to make your working copy up-to-date with remote repository
a named set of changes
a copy of repository
a main branch for work
a case, when few users made not-similar changes in one file
a latest version for branch
an action to combine independent changes to one version
a label for specific version of document
централізовані децентралізовані is the number of repositories
there is just one repository.
є один центральний репозиторій
there are multiple repositories
в кожного користувача є своя копія репозиторію на локалці
the final version is a merge of original version and edit. occurs when two different users make simultaneous, different changes to the same line of a file
кожна система контролю версій має свою специфіку
clone the project (tree of files/directories)from remote to local (filesystem)with specific version
is a:
because:
.git/
цикле разработки через Github на командах разного размера
$ git config $ git config --global user.name "John Doe" $ git config --global user.email johndoe@example.com $ git config --list $ git config user.name
$ git help command $ git command --help $ man git-command
# initializes a directory as a Git repository $ git init
# copy a git repository so you can add to it $ git clone git://github.com/schacon/simplegit.git
adds file contents to the staging area
$ git status -s ?? README ?? hello.rb $ git add README hello.rb $ git add *.rb $ git status -s A README A hello.rb # edit & save the "README" file $ git status -s AM README A hello.rb
adds file contents to the staging area
$ git status -s AM README A hello.rb $ git status -s M README D hello.rb
shows diff of what is staged and what is modified but unstaged
$ vim hello.rb $ git status -s M hello.rb $ git diff diff --git a/hello.rb b/hello.rb index d62ac43..8d15d50 100644 --- a/hello.rb +++ b/hello.rb @@ -1,7 +1,7 @@ class HelloWorld def self.hello - puts "hello world" + puts "hola mundo" end end
records a snapshot of the staging area
$ git config --global user.name 'Your Name' $ git config --global user.email you@somedomain.com $ git add hello.rb $ git status -s M hello.rb $ git commit -m 'my hola mundo changes' [master 68aa034] my hola mundo changes 1 files changed, 2 insertions(+), 1 deletions(-) $ git status # On branch master nothing to commit (working directory clean)
undo changes and commits
$ git status -s M README M hello.rb $ git add . $ git status -s M README M hello.rb $ git reset HEAD -- hello.rb Unstaged changes after reset: M hello.rb $ git status -s M README M hello.rb
remove files from the staging area
$ git rm hello.rb
list, add and delete remote repository aliases
$ git remote origin $ git remote -v origin git@github.com:github/git-reference.git (fetch) origin git@github.com:github/git-reference.git (push)
download new branches and data from a remote repository
fetch from a remote repo and try to merge into the current branch
$ git fetch github remote: Counting objects: 4006, done. remote: Compressing objects: 100% (1322/1322), done. remote: Total 2783 (delta 1526), reused 2587 (delta 1387) Receiving objects: 100% (2783/2783), 1.23 MiB | 10 KiB/s, done. Resolving deltas: 100% (1526/1526), completed with 387 local objects. From github.com:schacon/hw 8e29b09..c7c5a10 master -> github/master 0709fdc..d4ccf73 c-langs -> github/c-langs 6684f82..ae06d2b java -> github/java * [new branch] ada -> github/ada * [new branch] lisp -> github/lisp
push your new branches and data to a remote repository
$ git push github master Counting objects: 25, done. Delta compression using up to 2 threads. Compressing objects: 100% (25/25), done. Writing objects: 100% (25/25), 2.43 KiB, done. Total 25 (delta 4), reused 0 (delta 0) To git@github.com:schacon/hw.git * [new branch] master -> master
filter your commit history
$ git log --author=Linus --oneline -5 81b50f3 Move 'builtin-*' into a 'builtin/' subdirectory 3bb7256 make "index-pack" a built-in 377d027 make "git pack-redundant" a built-in b532581 make "git unpack-file" a built-in 112dd51 make "mktag" a built-iner
$ git diff v0.9 --stat README | 2 +- ruby.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
Github is the place where copies of your code files will be stored. Your github account is more important than your resume. It holds the record of all the code you've written, which open-source projects you've contributed to and how. Your github account is your developer portfolio.
http://pages.github.com/ http://your-name.github.io/your-repo/
TBD
write a good commit message to indicate the purpose of the changes
each commit should have a single purpose and should completely implement that purpose
make a commit with specific files
work with the most up-to-date version of the files as possible
very frequently to avoid conflicts
share a logical unit of work with your colleagues as soon as possible
strive to avoid conflicts. to talk with teammates is the best way to avoid conflicts
they aren't necessary in version control