網頁

顯示具有 Version Control 標籤的文章。 顯示所有文章
顯示具有 Version Control 標籤的文章。 顯示所有文章

2013年8月28日

A simple way to create git repository on a server machine connecting via ssh

Original Article: A simple way to create git repository on a server machine connecting via ssh

Situation:

Let’s assume following situation:
  • We have a folder ˜/workshop , that contains the project on a local machine
  • Our project folder workshop is not a git repository yet
  • We want to have a server that hosts the workshop project and new developer can get the repository using a ‘git clone …’ command
  • On server site, the new repository should be located unter ˜/gitrepos/workshop.git.
To simplify the following steps i will use the machine localhost as the server machine.

2013年4月11日

git snippet

Commit the changes into mutiple branch

Assume there are 2 brach, ‘master’, ‘2013Q1-branch’
git br –a
Change to master branch
git co master
Commit the changes
git add –i
git commit
gitt push

Lookup commit number. for example ‘3ec1b5b’
git la
Change to ‘2013Q1-branch’ branch
git co 2013Q1-branch
Apply the changes introduced by some existing commits
git cherry-pick 3ec1b5b
Modify log for the changes
git commit --amend

Commit the changes to this branch
git push

Remove all commits not in origin/master
git reset --hard origin/master

Show more line in diff mode
git diff -U100




2013年2月28日

Install Git

Snippet

專案常常都由多個人一起撰寫,需要版本控制的工具方便做原始碼的管理。建構 git server 的過程其實不是很難,掌握主要的概念就可以了。
首先是需要一個 git 的群組,我這邊的例子是叫做 developers,然後幫每一個人開一個 server 端上的帳號,然後把這些帳號加入 developers 群組裡。
接著新增一個專案資料夾,透過 git init –bare 的方式啟動 git 的管理,因為這個專案資料夾會由很多人做修改,因此此資料夾的群組與權限設定就變得很重要,記得把專案資料夾的 group 改成 developers,全線改成群組權限的人都可以做 rwx 的動作。
這樣才不會發生 user A 新增的檔案,到了 user B 的電腦裡,產生權限不符合,無法修改的問題。
最後就是回到 user 本地端的電腦,直接透過 git clone 的方式,把 git server 上的專案資料夾複製下來。
最後,就大功告成了。


2013年1月25日

SVN Snippet

Apache Subversion (often abbreviated SVN, after the command name svn) is a software versioning and revision control system distributed under an open source license.

SVN Command

svn help

provides a summary of the available commands

svn checkout/co

This command is used to pull an SVN tree from the server. You should only need to do this once.

svn add

When you are creating a new file or directory, you need to tell the SVN server about it. This command does that. Note that the file won't appear in the repository until you do an svn commit