沒有 GUI 的 Git

92
GUI Git

Transcript of 沒有 GUI 的 Git

�� GUI � Git� � �

1.çÑÙs 2.çÑC·�=��< 3.�B�L:�3.¦�˯ 4.I'Ã]�vw

�}v�xHÕz�¶ï

rTÕ�Í_hJ\²

� @afu ���https://www.youtube.com/watch?v=_yQlKEq-Ueg

�è�

Repository

Developer

Developer Developer

Developer

Developer Developer

�è� - äMÂ�

Repository

MainActivity.java

Developer

Repository

MainActivity.java

Developer

Repository

MainActivity.java

Developer

�è� - mëÂ�

Repository

MainActivity.java

Developer

Repository

MainActivity.java

Repository

MainActivity.java

Developer Developer

Repository

MainActivity.java

Developer Developer

!�

Develop Repository

Develop Develop

Develop Repository

Office Repository

Develop

Develop Repository

Fork

Develop Repository

Develop Develop

Develop Repository

Office Repository

Develop

Develop Repository

Commit

Develop Repository

Develop Develop

Develop Repository

Office Repository

Develop

Develop Repository

Pull Request

• ���Y+ (!Î�)

• »Ú���

• �}79� git �<4

� @oxxo ���

�¤m GUI or CLI?

https://www.facebook.com/groups/git.tw/permalink/991589810889687/?qa_ref=qd

Git o��pµ

Àq¹¿¡M

# ¡M log �¦��ì¾ git ⇒ git config --global user.name weitsai

# ¡M±Ý-Aà git ⇒ git config --global user.email [email protected]

# ¡MÄ- Editor (vim, sublime or atom…) git ⇒ git config --global core.editor vim

½H�Å

Local

hJ�¯

â´¥

git �¯

git ⇒ git init

â´¥

git �¯

git | master⚡ ⇒ touch test.md

hJ�¯

test

â´¥

git �¯

git | master⚡ ⇒ git add test.md

test

hJ�¯

â´¥

git �¯

git | master⚡ ⇒ git commit

test

hJ�¯

â´¥

git �¯

git | master ⇒ echo ‘test’ >> test.md

hJ�¯

test

â´¥

git �¯

git | master⚡ ⇒ git add test.md

test

hJ�¯

â´¥

git �¯

git | master⚡ ⇒ git commit -m ‘Update’

test

hJ�¯

���0…

git | master ⇒ echo ‘test’ >> test.md git | master⚡ ⇒ git add test.md

git | master ⇒ git cat-file -t 9daeafb9864cf43055ae93beb0afd6c7d144bfa4 blob

git | master ⇒ git cat-file -p 9daeafb9864cf43055ae93beb0afd6c7d144bfa4 test

git | master ⇒ git commit -m ‘Add test file’ [master (root-commit) 77f64af] Add test file 1 file changed, 1 insertion(+) create mode 100644 test.md

git | master ⇒ git cat-file -t 77f64af commit

git | master ⇒ git cat-file -p 77f64af

git | master ⇒ git cat-file -p 9098a4 100644 blob 9098a46b8a3cb674c82833688dfb5c77995053c2 test.md

git | master ⇒ git cat-file -t 9098a4 tree

Commit

77f64af

Tree Blob

9daeaf 77f64af

Remote

# �F�uÉ�iÑÛk git | master ⇒ git remote add origin {repo_url}

# å¼�uÉ�iÑÛk git | master ⇒ git remote rm origin

# ��uÉ�iÑÛk git | master ⇒ git remote -v

# �F�uÉ�iÑÛk git | master ⇒ git push origin master

# ��uÉ�iÑÛk git | master ⇒ git pull origin master

# ��uÉ�iÑÛk git | master ⇒ git clone {repo_url}

bé�Å

# � commit ��Q�#��7�˯ git | master ⇒ git commit -v

# �Ï��FçÑ git | master ⇒ git add -p

# ftRK·� git | master ⇒ git checkout -f

# �� commit ˯ git | master ⇒ git log

# º�·��l{ git | master ⇒ git log -p

# Ç�×.... git | master ⇒ git blame

# ��·�˯ git | master ⇒ git diff

# ª©��!� git | master ⇒ git checkout -b test

# ®$H%É�!� git | test ⇒ git branch # ®$L�!� í�Ó remote repo) git | test ⇒ git branch -a # �L�!�"1� commit git | test ⇒ git branch -vv

# @�K� commit �Ð� git | master ⇒ git reset HEAD~1

# @�K? commit �Ð� git | master ⇒ git reset HEAD^^

# �~¦�@æ� commit çÑ git | master ⇒ git reset —hard

# ^�³�; commit git | master ⇒ git revert HEAD~1

# &³!�:mëí���ʨî git | master ⇒ git merge —no-f q[branch]

# ' commit ˯:·� git | master ⇒ git rebase -i [commit]

# më�M!��6��!� git | master ⇒ git merge —no-f {branch_name}

Conflict

git | master ⇒ echo ‘ � GUI � GIT’ > README.md git | master⚡ ⇒ git add README.md git | master⚡ ⇒ git commit -m ‘Add README’

git | master ⇒ git checkout -b conflict git | conflict ⇒ echo ‘,� GUI � GIT’ > README.md git | conflict ⚡ ⇒ git add README.md git | conflict ⚡ ⇒ git commit -m ‘Update README’

git | conflict ⇒ git checkout master git | master ⇒ echo ‘�� GUI � GIT’ > README.md git | master ⚡ ⇒ git add README.md git | master ⚡ ⇒ git commit -m ‘Update README(master)’

git | master ⇒ git checkout conflict git | conflict ⇒ echo ‘,� GUI � GIT’ > README.md git | conflict ⚡ ⇒ git add README.md git | conflict ⚡ ⇒ git commit -m ‘Update README(conflict)’

git | conflict ⇒ git rebase master

git | conflict ⇒ vim README.md

��

��

https://www.flickr.com/photos/appleboy/5488984404

Master - ÞMxH Develop - *(�xH

Feature - X����� Release - ·X develop bug Hotfix - «Ö·X master bug

Commit

• ­j&l{t�E

• ­j�e� 50 �n

• ­j*O���Á

• ­j��P���

• ­j¬g�-�#Z���aí��dê�î

• l{�E"�� 72 �n

• l{¬g|Ü�5� �:ïc�:�ï

http://chris.beams.io/posts/git-commit/

>}Ò�2

SSH key

https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/

Alias

CRLF

# OS X git | master ⇒ git config --global core.autocrlf input

# Windows git | master ⇒ git config --global core.autocrlf true

Tool

https://github.com/buunguyen/octotree

https://rtyley.github.io/bfg-repo-cleaner/

Security

gitignore

git ⇒ javac test.java git ⇒ git status

http://gitignore.io/

https://github.com/github/gitignore

ÌØJ�Ä

https://help.github.com/articles/remove-sensitive-data/

# å¼á8W¢¸ git ⇒ git filter-branch --force --index-filter \ 'git rm --cached --ignore-unmatch *.md' \ --prune-empty --tag-name-filter cat -- --all

SVN

# ^�U� SVN iÑ svn ⇒ git svn clone -r HEAD {Repo URL}

# °`·��Æ�#[Dy� SVN Server git | master⚡ ⇒ git svn rebase

# N²��V� Server � git | master⚡ ⇒ git svn dcommit

�§Gã• Git Book

• A successful Git branching model (Gitflow)

• iHower - !�*(\²&ßÔ

• How to Write a Git Commit Message

• Generating a new SSH key and adding it to the ssh-agent

�§Gã• What are the best hosted version control services?