Git is a distributed version control system (no central server)
On Ubuntu and similar systems:
sudo apt-get install git
On Fedora, Red Hat and similar systems
yum install git
The working tree status
git status
Add file in staging
git add .
Commit to git repository
git commit -m "add a file index.php"
Show git log for change
git log
remove a file
git rm index.php
git commit -m "remove file index.php"
For collaborative work flow
My flow:
> git checkout master
>git fetch
>git merge origin/master
now create another branch test_website, better directly working o9n master branch
>git checkout b test_website
//modify index.php and put in staging
>git add index.php
//then put in git repository
>git commit -m "add contact in index.php"
>git fetch
>git push -u origin test_website
GIt remote:
$ git remote add origin git://github.com/paulboone/ticgit.git
$ git remote -v
My collaborator flow
> git checkout master
>git fetch
>git merge origin/master
check out my work
>git checkout -b test_website origin/test_website
check out what I did
> git log
He make some change on the code and commit
>git commit -am "add jiansen in contact.php"
make sure the local code up-to-date using fetch
>git fetch
push the code in remote
>git push
Back to my flow
>git fetch
>git log -p test_website..origin/test_website
sync my local test_website
>git merge origin/test_website
go back master branch
>git checkout master
>git fetch
>git merge origin/master
merge in branch test_website in master
>git merge test_website
update remote
>git push
Reference:
http://www.vogella.com/tutorials/Git/article.html
No comments:
Post a Comment