From c05c2e51639c14ff1a87e6e37fbe15352a1fc291 Mon Sep 17 00:00:00 2001 From: suthee Date: Thu, 30 Apr 2015 19:41:28 -0700 Subject: [PATCH 1/3] in progress Thai translation --- index.html | 1 + index.th.html | 275 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 276 insertions(+) create mode 100644 index.th.html diff --git a/index.html b/index.html index 09dda754..e72cb25c 100644 --- a/index.html +++ b/index.html @@ -50,6 +50,7 @@

git - the simple guide

中文, 한국어 Vietnamese + ภาษาไทย
please report issues on github

diff --git a/index.th.html b/index.th.html new file mode 100644 index 00000000..1e99fd04 --- /dev/null +++ b/index.th.html @@ -0,0 +1,275 @@ + + + + + + git - คู่มือแบบง่ายๆ - ไม่ได้โม้นะ! + + + + + + +
+

git - คู่มือแบบง่ายๆ

+

นี่คือคู่มือการใช้ Git แบบง่ายๆ - ไม่ได้โม้ด้วย ;)

+ + +

+ โดยคุณ Roger Dudler +
เครดิตแก่คุณ @tfnico, @fhd และคุณ Namics
+ คู่มือนี้ในภาษา + deutsch, + español, + français, + indonesian, + italiano, + nederlands, + polski, + português, + русский, + türkçe, +
+ မြန်မာ, + 日本語, + 中文, + 한국어 + Vietnamese + ภาษาไทย +
+ ถ้ามีข้อบกพร่อง โปรดแจ้งที่ github +

+
+ + Frontify - Collaboration for Web Designers & Front-End Developers + +
+ +
+ + +
+

การติดตั้ง

+

+ ดาวน์โหลด git สำหรับ OSX +

+

+ ดาวน์โหลด git สำหรับ วินโดว์ +

+

+ ดาวน์โหลด git สำหรับ ลินุกซ์ +

+
+ +
+

สร้างฐานข้อมูลใหม่

+

+ สร้าง directory ใหม่ก่อน, เปิดเข้าไปแล้วพิมพ์
+ git init
+ เพื่อสร้างฐานข้อมูล git ตัวใหม่ +

+
+ +
+

เช็คเอาท์ฐานข้อมูล

+

+ สร้างสำเนาฐานข้อมูลใหม่ โดยพิมพ์คำสั่ง
+ git clone /path/to/repository
+ ถ้าฐานข้อมูลอยู่บนเซิฟเวอร์ คุณต้องพิมพ์
+ git clone username@host:/path/to/repository +

+
+ +
+

ขั้นตอนการทำงาน

+

+ ฐานข้อมูลของคุณจะมี "tree" อยู่สามอันที่ถูกดูแลด้วย git + ตัวแรกคือ Working Directory ซึ่งเก็บไฟล์ทั้งหมดไว้ + ตัวที่สองคือ Index ซึ่งเป็นพื้นที่สำหรับ staging (ลำดับการเปลี่ยนแปลงของข้อมูล) และ + สุดท้ายคือ HEAD ซึ่งจะชี้ไปยังการบันทึกข้อมูล (commit) ครั้งสุดท้ายของคุณ +

+ +
+ +
+

การเพิ่มเติม (add) & บันทึก (commit)

+

+ คุณสามารถเสนอการเปลี่ยนข้อมูลหรือไฟล์ (โดยใส่ไว้ใน Index) ด้วยคำสั่ง
+ git add <filename>
+ git add *
+ นี่คือขั้นตอนแรกสำหรับขั้นตอนการทำงานของ git ถ้าจะบันทึก (commit) ข้อมูลเปลี่ยนใหม่ คุณจะต้องพิมพ์
+ git commit -m "Commit message"
+ ไฟล์ก็จะถูกบันทึกลงบน HEAD แต่ยังไม่ได้บันทึกลงฐานข้อมูลบนเซิฟเวอร์ +

+
+ +
+

ส่งข้อมูลที่เปลี่ยนแปลงใหม่ (pushing changes)

+

+ ข้อมูลใหม่ยังอยู่บน HEAD ของฐานข้อมูลส่วนตัว ถ้าคุณต้องการจะส่งข้อมูลที่เปลี่ยนใหม่ไปยังฐานข้อมูลบนเซิฟเวอร์ ทำตามคำสั่งนี้
+ git push origin master
+ เปลี่ยนคีย์เวิร์ด master เป็น branch ที่คุณต้องการจะส่งข้อมูลไป +

+ ถ้าคุณยังไม่ได้ทำสำเนาของฐานข้อมูลแต่ว่าคุณต้องการจะเชื่อมฐานข้อมูลนี้กับเซิฟเวอร์ คุณต้องพิมพ์ตามนี้
+ git remote add origin <server>
+ คุณก็จะสามารถส่งข้อมูลที่เปลี่ยนใหม่ไปยังเซิฟเวอร์ที่คุณต้องการได้
+ +

+
+ +
+

บร้านชิ่ง (branching)

+

+ Branches เป็นที่ใช้สำหรับพัฒนา features ตัวใหม่โดยไม่ต้องรบกวนตัวอื่น master branch เป็น "default" branch (บร้านที่ถูกเลือกโดยอัตโนมัติ) เมื่อคุณสร้างฐานข้อมูลครั้งแรก คุณต้องใช้ branches ตัวอื่นสำหรับการพัฒนาอย่างอื่นและ merge พวกมันกลับเข้ามาที่ master branch เมื่อพัฒนาเสร็จแล้ว +

+ +

+ สร้าง branch ใหม่ชื่อ "feature_x" และเริ่มใช้มัน โดยต้องพิมพ์
+ git checkout -b feature_x
+ เปลี่ยนกลับมาที่ตัวมาสเตอร์ (master)
+ git checkout master
+ และลบ branch ทิ้ง
+ git branch -d feature_x
+ คนอื่นจะ ไม่สามารถใช้ branch ของคุณได้จนกว่าคุณจะส่งตัว branch ของคุณไปยังฐานข้อมูลบนเซิฟเวอร์
+ git push origin <branch> +

+
+ +
+

การอัพเดท & การรวบรวมข้อมูล (merge)

+

+ จะอัพเดทฐานข้อมูลส่วนตัวให้มีข้อมูลใหม่จากเซิฟเวอร์ คุณต้องพิมพ์
+ git pull
+ ใน directory ปัจจุบัน เพื่อจะได้ดึงข้อมูล (fetch) และ รวบรวมข้อมูล (merge) จากฐานข้อมูลบนเซิฟเวอร์
+ to merge another branch into your active branch (e.g. master), use
+ git merge <branch>
+ in both cases git tries to auto-merge changes. Unfortunately, this is not always possible and results in conflicts. + You are responsible to merge those conflicts + manually by editing the files shown by git. After changing, you need to mark them as merged with
+ git add <filename>
+ before merging changes, you can also preview them by using
+ git diff <source_branch> <target_branch> +

+
+ +
+

tagging

+

+ it's recommended to create tags for software releases. this is a known concept, which also exists in SVN. You can create a new tag named 1.0.0 by executing
+ git tag 1.0.0 1b2e1d63ff
+ the 1b2e1d63ff stands for the first 10 characters of the commit id you want to reference with your tag. You can get the commit id by looking at the...
+

+
+ +
+

log

+

+ in its simplest form, you can study repository history using.. + git log
+ You can add a lot of parameters to make the log look like what you want. To see only the commits of a certain author:
+ git log --author=bob
+ To see a very compressed log where each commit is one line:
+ git log --pretty=oneline
+ Or maybe you want to see an ASCII art tree of all the branches, decorated with the names of tags and branches:
+ git log --graph --oneline --decorate --all
+ See only which files have changed:
+ git log --name-status
+ These are just a few of the possible parameters you can use. For more, see + git log --help
+

+
+ +
+

replace local changes

+

+ In case you did something wrong, which for sure never happens ;), you can replace local changes using the command
+ git checkout -- <filename>
+ this replaces the changes in your working tree with the last content in HEAD. Changes already added to the index, as well as new files, will be kept. +

+

+ If you instead want to drop all your local changes and commits, fetch the latest history from the server and point your local master branch at it like this
+ git fetch origin
+ git reset --hard origin/master +

+
+ +
+

useful hints

+

+ built-in git GUI
+ gitk
+ use colorful git output
+ git config color.ui true
+ show log on just one line per commit
+ git config format.pretty oneline
+ use interactive adding
+ git add -i +

+
+ +
+

links & resources

+

graphical clients

+

+

+

+

guides

+

+

+

+

get help

+

+

+

+
+ +
+

comments

+
+ + +
+ + + + From 7f343590699f850498c569676f94363b6efcac40 Mon Sep 17 00:00:00 2001 From: suthee Date: Thu, 30 Apr 2015 22:11:07 -0700 Subject: [PATCH 2/3] translate to Thai --- index.th.html | 75 +++++++------- index.th.html~ | 275 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 312 insertions(+), 38 deletions(-) create mode 100644 index.th.html~ diff --git a/index.th.html b/index.th.html index 1e99fd04..2c8e1f26 100644 --- a/index.th.html +++ b/index.th.html @@ -98,10 +98,10 @@

เช็คเอาท์ฐานข้อมูล

ขั้นตอนการทำงาน

- ฐานข้อมูลของคุณจะมี "tree" อยู่สามอันที่ถูกดูแลด้วย git - ตัวแรกคือ Working Directory ซึ่งเก็บไฟล์ทั้งหมดไว้ - ตัวที่สองคือ Index ซึ่งเป็นพื้นที่สำหรับ staging (ลำดับการเปลี่ยนแปลงของข้อมูล) และ - สุดท้ายคือ HEAD ซึ่งจะชี้ไปยังการบันทึกข้อมูล (commit) ครั้งสุดท้ายของคุณ + ฐานข้อมูลของคุณจะมี "tree" อยู่สามอันที่ถูกดูแลด้วย git ซึ่ง + tree ตัวแรกคือ Working Directory จะเก็บไฟล์ทั้งหมดไว้ จากนั้น + tree ตัวที่สองคือ Index จะเป็นพื้นที่สำหรับ staging (ลำดับการเปลี่ยนแปลงของข้อมูล) และ + tree สุดท้ายคือ HEAD ซึ่งจะชี้ไปยังการบันทึกข้อมูลครั้งสุดท้าย

@@ -112,9 +112,9 @@

การเพิ่มเติม (add) & บันทึก (commit) คุณสามารถเสนอการเปลี่ยนข้อมูลหรือไฟล์ (โดยใส่ไว้ใน Index) ด้วยคำสั่ง
git add <filename>
git add *
- นี่คือขั้นตอนแรกสำหรับขั้นตอนการทำงานของ git ถ้าจะบันทึก (commit) ข้อมูลเปลี่ยนใหม่ คุณจะต้องพิมพ์
+ นี่คือขั้นตอนแรกสำหรับขั้นตอนการทำงานของ git ถ้าจะบันทึกข้อมูลที่เสนอไป คุณจะต้องพิมพ์
git commit -m "Commit message"
- ไฟล์ก็จะถูกบันทึกลงบน HEAD แต่ยังไม่ได้บันทึกลงฐานข้อมูลบนเซิฟเวอร์ + ไฟล์ก็จะถูกบันทึกลงบน HEAD แต่ไม่ได้บันทึกลงฐานข้อมูลบนเซิฟเวอร์

@@ -141,11 +141,11 @@

บร้านชิ่ง (branching)

สร้าง branch ใหม่ชื่อ "feature_x" และเริ่มใช้มัน โดยต้องพิมพ์
git checkout -b feature_x
- เปลี่ยนกลับมาที่ตัวมาสเตอร์ (master)
+ เปลี่ยนมาเป็นตัวมาสเตอร์
git checkout master
และลบ branch ทิ้ง
git branch -d feature_x
- คนอื่นจะ ไม่สามารถใช้ branch ของคุณได้จนกว่าคุณจะส่งตัว branch ของคุณไปยังฐานข้อมูลบนเซิฟเวอร์
+ คนอื่นจะ ไม่สามารถใช้ branch ของคุณได้จนกว่าคุณจะส่งตัว branch ของคุณไปยังฐานข้อมูลบนเซิฟเวอร์ ให้ทำตามนี้
git push origin <branch>

@@ -156,75 +156,74 @@

การอัพเดท & การรวบรวมข้อมู จะอัพเดทฐานข้อมูลส่วนตัวให้มีข้อมูลใหม่จากเซิฟเวอร์ คุณต้องพิมพ์
git pull
ใน directory ปัจจุบัน เพื่อจะได้ดึงข้อมูล (fetch) และ รวบรวมข้อมูล (merge) จากฐานข้อมูลบนเซิฟเวอร์
- to merge another branch into your active branch (e.g. master), use
+ ถ้าจะ merge บร้านตัวอื่นมาที่บร้านของคุณเอง (อย่างเช่น มาสเตอร์บร้าน) คุณต้องพิมพ์
git merge <branch>
- in both cases git tries to auto-merge changes. Unfortunately, this is not always possible and results in conflicts. - You are responsible to merge those conflicts - manually by editing the files shown by git. After changing, you need to mark them as merged with
+ วิธีที่กล่าวมานี้ git จะพยายามรวบรวมข้อมูลทั้งหมดโดยอัตโนมัติ แต่ว่าบางครั้ง git ก็ไม่สามารถรวบรวมข้อมูลได้เอง ซึ่งสถานการณ์นี้เรียกว่า conflicts. + เป็นหน้าที่ของคุณที่ต้องแก้ไขและรวบรวมตัว conflicts เหล่านี้โดยแก้ที่ไฟล์แต่ละตัว หลังจากแก้ไขเสร็จแล้วคุณก็จะ merge ได้โดยพิมพ์
git add <filename>
- before merging changes, you can also preview them by using
+ ก่อนจะ merging คุณสามารถดูตัวอย่างไฟล์ได้ด้วยคำสั่ง
git diff <source_branch> <target_branch>

-

tagging

+

แท๊กกิ้ง (tagging)

- it's recommended to create tags for software releases. this is a known concept, which also exists in SVN. You can create a new tag named 1.0.0 by executing
+ แนะนำให้คุณสร้างแท๊กทุกครั้งที่เปิดตัวซอร์ฟแวร์ วิธีการนี้เรียกว่า concept ซึ่ง SVN ก็มีเช่นกัน คุณสร้างแท๊กตัวใหม่ ชื่อ 1.0.0 โดยพิมพ์คำสั่ง
git tag 1.0.0 1b2e1d63ff
- the 1b2e1d63ff stands for the first 10 characters of the commit id you want to reference with your tag. You can get the commit id by looking at the...
+ 1b2e1d63ff คืออักษร 10 ตัวแรกจากไอดีการบันทึก (commit id) ที่คุณต้องการจะเชื่อมกับแท๊ก คุณสามารถหาไอดีการบันทึกได้จาก...

-

log

+

ล็อก (log)

- in its simplest form, you can study repository history using.. + คุณสามารถดูประวัติของฐานข้อมูลได้โดยคำสั่ง.. git log
- You can add a lot of parameters to make the log look like what you want. To see only the commits of a certain author:
+ คุณสามารถใส่พารามีเตอร์ไปยังล็อกเพื่อให้มันแสดงผลลัพธ์ที่คุณต้องการ ถ้าอยากจะได้ประวัติการบันทึกของโปรแกรมเมอร์คนใดคนหนึ่ง คุณพิมพ์:
git log --author=bob
- To see a very compressed log where each commit is one line:
+ ถ้าอยากได้ล็อกที่สั้นๆโดยประวัติการบันทึกถูกจดไว้ในแต่ละแถว ใช้คำสั่ง:
git log --pretty=oneline
- Or maybe you want to see an ASCII art tree of all the branches, decorated with the names of tags and branches:
+ หรือถ้าอยากจะเห็นรูปวาด ASCII art tree ของบร้านทุกตัว โดยมีชื่อกับแท้ก ต้องพิมพ์:
git log --graph --oneline --decorate --all
- See only which files have changed:
+ อยากจะเห็นเพียงไฟล์ถูกเปลี่ยน:
git log --name-status
- These are just a few of the possible parameters you can use. For more, see + ที่บอกมานี่ยังเป็นแค่ส่วนหนึ่งของพารามีเตอร์เท่านั้น อยากจะรู้มากกว่านี้ ไปเปิดดูที่ git log --help

-

replace local changes

+

การแทนที่ข้อมูลปัจจุบัน (replace local changes)

- In case you did something wrong, which for sure never happens ;), you can replace local changes using the command
+ บางทีคุณอาจจะทำข้อมูลเสียหาย ซึ่งก็ไม่เกิดขึ้นหรอกนะ ;), คุณสามารถเริ่มข้อมูลใหม่ได้โดยแทนค่าข้อมูลเก่าด้วยคำสั่ง
git checkout -- <filename>
- this replaces the changes in your working tree with the last content in HEAD. Changes already added to the index, as well as new files, will be kept. + คำสั่งนี้แทนข้อมูลใน working tree ด้วยข้อมูลจาก HEAD ข้อมูลที่ถูกเปลี่ยนก็ได้บันทึกลงบน index และไฟล์ใหม่ก็ถูกบันทึกด้วย

- If you instead want to drop all your local changes and commits, fetch the latest history from the server and point your local master branch at it like this
+ แต่ถ้าคุณอยากจะทิ้งข้อมูลใหม่ทั้งหมดที่คุณสร้างและก็บันทึกไว้ด้วย คุณควรจะดึงข้อมูลล่าสุดจากเซิฟเวอร์และก็เชื่อมต่อกับ master branch ส่วนตัวของคุณ โดยทำตามนี้
git fetch origin
git reset --hard origin/master

-

useful hints

+

คำแนะนำอื่นๆ

built-in git GUI
gitk
- use colorful git output
+ ตกแต่งผลลัพธ์ของ git ด้วยสีสวยๆ
git config color.ui true
- show log on just one line per commit
+ แสดงผลการบันทึกอย่างละบรรทัดบนล็อก
git config format.pretty oneline
- use interactive adding
+ เพิ่มไฟล์แบบ interactive
git add -i

-

links & resources

-

graphical clients

+

ลิ้งและข้อมูลเพิ่มเติม

+

โปรแกรม git พร้อมกราฟฟิค (graphical clients)

-

guides

+

คู่มือ

-

get help

+

คำแนะนำเพิ่มเติม

-

comments

+

ติชมได้ที่นี่ (comments)

+ + +
+

git - the simple guide

+

just a simple guide for getting started with git. no deep shit ;)

+ + +

+ by Roger Dudler +
credits to @tfnico, @fhd and Namics
+ this guide in + deutsch, + español, + français, + indonesian, + italiano, + nederlands, + polski, + português, + русский, + türkçe, +
+ မြန်မာ, + 日本語, + 中文, + 한국어 + Vietnamese + ภาษาไทย +
+ please report issues on github +

+
+ + Frontify - Collaboration for Web Designers & Front-End Developers + +
+ +
+ + + + +
+

create a new repository

+

+ create a new directory, open it and perform a
+ git init
+ to create a new git repository. +

+
+ +
+

checkout a repository

+

+ create a working copy of a local repository by running the command
+ git clone /path/to/repository
+ when using a remote server, your command will be
+ git clone username@host:/path/to/repository +

+
+ +
+

workflow

+

+ your local repository consists of three "trees" maintained by git. + the first one is your Working Directory which holds the actual files. + the second one is the Index which acts as a staging area and + finally the HEAD which points to the last commit you've made. +

+ +
+ +
+

add & commit

+

+ You can propose changes (add it to the Index) using
+ git add <filename>
+ git add *
+ This is the first step in the basic git workflow. To actually commit these changes use
+ git commit -m "Commit message"
+ Now the file is committed to the HEAD, but not in your remote repository yet. +

+
+ +
+

pushing changes

+

+ Your changes are now in the HEAD of your local working copy. To send those changes to your remote repository, execute
+ git push origin master
+ Change master to whatever branch you want to push your changes to. +

+ If you have not cloned an existing repository and want to connect your repository to a remote server, you need to add it with
+ git remote add origin <server>
+ Now you are able to push your changes to the selected remote server
+ +

+
+ +
+

branching

+

+ Branches are used to develop features isolated from each other. The master branch is the "default" branch when you create a repository. Use other branches for development and merge them back to the master branch upon completion. +

+ +

+ create a new branch named "feature_x" and switch to it using
+ git checkout -b feature_x
+ switch back to master
+ git checkout master
+ and delete the branch again
+ git branch -d feature_x
+ a branch is not available to others unless you push the branch to your remote repository
+ git push origin <branch> +

+
+ +
+

update & merge

+

+ to update your local repository to the newest commit, execute
+ git pull
+ in your working directory to fetch and merge remote changes.
+ to merge another branch into your active branch (e.g. master), use
+ git merge <branch>
+ in both cases git tries to auto-merge changes. Unfortunately, this is not always possible and results in conflicts. + You are responsible to merge those conflicts + manually by editing the files shown by git. After changing, you need to mark them as merged with
+ git add <filename>
+ before merging changes, you can also preview them by using
+ git diff <source_branch> <target_branch> +

+
+ +
+

tagging

+

+ it's recommended to create tags for software releases. this is a known concept, which also exists in SVN. You can create a new tag named 1.0.0 by executing
+ git tag 1.0.0 1b2e1d63ff
+ the 1b2e1d63ff stands for the first 10 characters of the commit id you want to reference with your tag. You can get the commit id by looking at the...
+

+
+ +
+

log

+

+ in its simplest form, you can study repository history using.. + git log
+ You can add a lot of parameters to make the log look like what you want. To see only the commits of a certain author:
+ git log --author=bob
+ To see a very compressed log where each commit is one line:
+ git log --pretty=oneline
+ Or maybe you want to see an ASCII art tree of all the branches, decorated with the names of tags and branches:
+ git log --graph --oneline --decorate --all
+ See only which files have changed:
+ git log --name-status
+ These are just a few of the possible parameters you can use. For more, see + git log --help
+

+
+ +
+

replace local changes

+

+ In case you did something wrong, which for sure never happens ;), you can replace local changes using the command
+ git checkout -- <filename>
+ this replaces the changes in your working tree with the last content in HEAD. Changes already added to the index, as well as new files, will be kept. +

+

+ If you instead want to drop all your local changes and commits, fetch the latest history from the server and point your local master branch at it like this
+ git fetch origin
+ git reset --hard origin/master +

+
+ +
+

useful hints

+

+ built-in git GUI
+ gitk
+ use colorful git output
+ git config color.ui true
+ show log on just one line per commit
+ git config format.pretty oneline
+ use interactive adding
+ git add -i +

+
+ + + +
+

comments

+
+ + +
+ + + + From 3320f251856e2a0054658a24795b8684fbbf8e7a Mon Sep 17 00:00:00 2001 From: suthee Date: Thu, 30 Apr 2015 22:24:57 -0700 Subject: [PATCH 3/3] remove temporary file --- index.th.html~ | 275 ------------------------------------------------- 1 file changed, 275 deletions(-) delete mode 100644 index.th.html~ diff --git a/index.th.html~ b/index.th.html~ deleted file mode 100644 index e72cb25c..00000000 --- a/index.th.html~ +++ /dev/null @@ -1,275 +0,0 @@ - - - - - - git - the simple guide - no deep shit! - - - - - - -
-

git - the simple guide

-

just a simple guide for getting started with git. no deep shit ;)

- - -

- by Roger Dudler -
credits to @tfnico, @fhd and Namics
- this guide in - deutsch, - español, - français, - indonesian, - italiano, - nederlands, - polski, - português, - русский, - türkçe, -
- မြန်မာ, - 日本語, - 中文, - 한국어 - Vietnamese - ภาษาไทย -
- please report issues on github -

-
- - Frontify - Collaboration for Web Designers & Front-End Developers - -
- -
- - - - -
-

create a new repository

-

- create a new directory, open it and perform a
- git init
- to create a new git repository. -

-
- -
-

checkout a repository

-

- create a working copy of a local repository by running the command
- git clone /path/to/repository
- when using a remote server, your command will be
- git clone username@host:/path/to/repository -

-
- -
-

workflow

-

- your local repository consists of three "trees" maintained by git. - the first one is your Working Directory which holds the actual files. - the second one is the Index which acts as a staging area and - finally the HEAD which points to the last commit you've made. -

- -
- -
-

add & commit

-

- You can propose changes (add it to the Index) using
- git add <filename>
- git add *
- This is the first step in the basic git workflow. To actually commit these changes use
- git commit -m "Commit message"
- Now the file is committed to the HEAD, but not in your remote repository yet. -

-
- -
-

pushing changes

-

- Your changes are now in the HEAD of your local working copy. To send those changes to your remote repository, execute
- git push origin master
- Change master to whatever branch you want to push your changes to. -

- If you have not cloned an existing repository and want to connect your repository to a remote server, you need to add it with
- git remote add origin <server>
- Now you are able to push your changes to the selected remote server
- -

-
- -
-

branching

-

- Branches are used to develop features isolated from each other. The master branch is the "default" branch when you create a repository. Use other branches for development and merge them back to the master branch upon completion. -

- -

- create a new branch named "feature_x" and switch to it using
- git checkout -b feature_x
- switch back to master
- git checkout master
- and delete the branch again
- git branch -d feature_x
- a branch is not available to others unless you push the branch to your remote repository
- git push origin <branch> -

-
- -
-

update & merge

-

- to update your local repository to the newest commit, execute
- git pull
- in your working directory to fetch and merge remote changes.
- to merge another branch into your active branch (e.g. master), use
- git merge <branch>
- in both cases git tries to auto-merge changes. Unfortunately, this is not always possible and results in conflicts. - You are responsible to merge those conflicts - manually by editing the files shown by git. After changing, you need to mark them as merged with
- git add <filename>
- before merging changes, you can also preview them by using
- git diff <source_branch> <target_branch> -

-
- -
-

tagging

-

- it's recommended to create tags for software releases. this is a known concept, which also exists in SVN. You can create a new tag named 1.0.0 by executing
- git tag 1.0.0 1b2e1d63ff
- the 1b2e1d63ff stands for the first 10 characters of the commit id you want to reference with your tag. You can get the commit id by looking at the...
-

-
- -
-

log

-

- in its simplest form, you can study repository history using.. - git log
- You can add a lot of parameters to make the log look like what you want. To see only the commits of a certain author:
- git log --author=bob
- To see a very compressed log where each commit is one line:
- git log --pretty=oneline
- Or maybe you want to see an ASCII art tree of all the branches, decorated with the names of tags and branches:
- git log --graph --oneline --decorate --all
- See only which files have changed:
- git log --name-status
- These are just a few of the possible parameters you can use. For more, see - git log --help
-

-
- -
-

replace local changes

-

- In case you did something wrong, which for sure never happens ;), you can replace local changes using the command
- git checkout -- <filename>
- this replaces the changes in your working tree with the last content in HEAD. Changes already added to the index, as well as new files, will be kept. -

-

- If you instead want to drop all your local changes and commits, fetch the latest history from the server and point your local master branch at it like this
- git fetch origin
- git reset --hard origin/master -

-
- -
-

useful hints

-

- built-in git GUI
- gitk
- use colorful git output
- git config color.ui true
- show log on just one line per commit
- git config format.pretty oneline
- use interactive adding
- git add -i -

-
- - - -
-

comments

-
- - -
- - - -