2014年5月21日 星期三

Working Locally with Git

image

 

Create a local repository

image

image

image

 

Modify a file, add to stage, commit to repository

image

image

 

See difference between 2 versions

image

 

Create 2 files, add to stage, commit to repository, see diff

image

-u: only add updated files (modified or deleted)

-A: add all files

image

image

 

Modify 2 files, add separately to stage, commit separately to repository

image

image

image

 

Example:

1. Delete 1 file, add to stage with –u option

2. Create 1 file, add to stage with file name

3. Rename 1 file, add to stage with –A option

4. Commit all to repository

 

1. Delete 1 file, add to stage with –u option

image

2. Create 1 file, add to stage with file name

image

3. Rename 1 file, add to stage with –A option

image

4. Commit all to repository

image

 

Undo 1 change in working copy (checkout)

image

 

Undo multiple changes in working copy (reset --hard)

image

 

Undo the latest commit to staging (reset --soft)

image

image

image

image

image

 

Undo the latest commit (reset --hard)

image

image

image

image

 

Clean working copy (clean -n, -f)

image

 

Ignore files with .gitignore

image

image

image

沒有留言:

張貼留言