ӿʼGit֮ãڸ˿ߣ - ҵ綯̬ - ɽ˴֪ϢƼ޹˾

ɫɫС˵,õ,yings88

ʱ䣺2020-01-27 04:16:26 ԴGary Robinson's Rant

       PHP100ԭ룬תɫɫС˵,õ,yings88뿴ĩתҪлл

       ڱӿʼGit֮áмҾǰһһѸʱGitָϡȻˣֻGitʹ÷ʽԳĸ˿˵Ѿ㹻ˣܹϼɳ

(1)


       GitָϵĿܻһոտʼһĿѧijûбҪ˷ˡر뵽ҵĶӣѾд൱Ĵ룬ȴûʱȥѧϰһ汾ϵͳҲѧ뷨ΪдʹGit˵塣SubversionһɡԴİ汾ϵͳûзº׵ʹֻҪӲﶨڵݣҪģӵGitָҲõʲôˣǺġ

       ٴַʽʹGitֻЩʵĵطᶨбݲԵĸ˿ߡɫɫС˵,õ,yings88Gitѧϰһݲԣܹеύļܹ仯ؽһҪڰ汾

       Ϊʲôܹؼ֪ôһÿ˺ͺķʱ¼֮һʶиȥöڰչˡ£ܹʱı仯صȥڰ汾һ޴İ⣬صȥܸһַʽ---ҲõʵӦΪܹصȥ

       лʱӦúԥѧϰںͷ֧¹ܣдԶ̴洢ͺͻȡϢѧĶȻdzõġ

ӰװʼʹGit

       㻹ûаװGitʼҳϵİװ˵ɡ

(2)



       һʹGitʱǼĿĿ¼﹤Ҫĵһǣ

       git init

       ΪʹGitʼĿĿ¼

GitЩļ

       GitӦùЩļкܶļɫɫС˵,õ,yings88ôɣ

       git add   ...

       ҪļˡֻߵĿ¼ļʱôɣ

       git add .

       ľҲһ֣ŵǰĿ¼

ύı

       ҪύıˡֻҪύıһļʱôɣ

       git commit   ... -m ύϢ

       ߣύϴύ֮ıļôɣ

       Git commit -a -m иıļύϢ

       Ҫ֤ύϢ㹻ϢֱܷصǸ汾ˡ

ʷ¼

       Ҫһڵľɰ汾һַύϢŵÿ汾ġhashһͰ汾֣ʹÿһ汾ʽʾ

(3)



       git log --pretty=oneline

       ͻʾϵʾÿύhashεύϢ

       dbe28a0a1eba45d823d309cc3659069fc16297e3 4th version Ҫύ

       13bbf385e6d1f94c7f11a4cdfa2a7688dfdd84f8 3rd

       a1696f671fb90dc8ea34645a6f851d0ab0152fc2 2nd

       version179e59467039c7a7b81f676297415c8e018542a0 first version

       ע⣬㻹ôɣ

       git log

       Ҫϸÿ汾кܶеַʽôɣ

       git log --pretty=oneline --

       ijļɫɫС˵,õ,yings88Ҫעڶۺź滹пո񣡣

ؽһɰ汾

       󣬰һļָǰһ汾ֻҪʹhash㹻汾Ψһʶǰļôɣ

       git checkout  --

       磬

       git checkout 179e59467039 -- myfile

(4)



       ܰҵļݻָ179e59467039c7a7b81f676297415c8e018542a0 hashļĵһύ汾ֵΪmyfileļ

鿴ı

       ͨûȲ鿴ĸıǰȡļľɰ汾Ϊ˱Ƚijļĵǰ汾һʷ汾һϵеIJͬԲοʷ汾hash

       git diff  --

       ͬأҲԱȽʷ汾IJ֮ͬ

       git diff   --

Ŷˣһ--ѡ--ܻһŶ

       ͨЩ棬⻹һҲᷢɫɫС˵,õ,yings88Ǵ洦ġڲΪˣͱ--´Ҳٿء

       ʱȷЩļıˣΪҳǣôɣ

       git status

       ͻһļõһб磬һûбgit addļᱻΪûвгȽҪļӦ

       Gitָںѡԭܻе㲻㣬Ϊгܶ㲻ĵļ磬Pythonд룬ͻչʾPythonıļ.pyܻܿҪΪʲô

       Ϊ޸⣬ҪĿĿ¼ﴴһΪ.gitignoreļ磬Python 2.xһĿϹ٣*.pyc

       ע⵽.gitignoreܹͨ*Ŀ¼ļһбߡ磬Python 3.xϹļһ__pycache__Ŀ¼.gitignoreôɣ

       __pycache__/

(5)



       GitָϷֱߡ

       㿪ʼGit֮Ҫ֪ĶֻҪӲжڵıݲԡҪύ֮㲻סκζGitָϷղؼܹҪʱ򷽱ύȽϰ汾ͻȡļľɰ汾ˡ
       סΪ㾡ܻȡһЩʹGitõ֪ʶָϾܼͨ׶֧ɫɫС˵,õ,yings88ͨһԶ̷ĸǿĹܣһҪƲӿʼGit֮áעһ...лῴĻиϸGitָϡ


ԭģhttp://www.garyrobinson.net/2014/10/git-in-two-minutes-for-a-solo-developer.html

ģhttp://www.php100.com/html/it/focus/2014/1023/7586.html

PHP100_Alex

Ƽ

ΪʲôFacebookֹͣʹPHP

ɫɫС˵,õ,yings88

PHPֹSQLע룿

ñֵȥ̰


վͼ