GITIGNORE Cov Ntaub Ntawv (Nws Yog Dab Tsi thiab Yuav Qhib Li Cas)

Cov txheej txheem:

GITIGNORE Cov Ntaub Ntawv (Nws Yog Dab Tsi thiab Yuav Qhib Li Cas)
GITIGNORE Cov Ntaub Ntawv (Nws Yog Dab Tsi thiab Yuav Qhib Li Cas)
Anonim

A cov ntaub ntawv nrog GITIGNORE cov ntaub ntawv txuas ntxiv yog Git Ignore cov ntaub ntawv siv nrog version / qhov chaw tswj hwm hu ua Git.

Dab tsi yog GITIGNORE File?

A Git Ignore cov ntaub ntawv qhia tias cov ntaub ntawv twg thiab cov folders yuav tsum raug ignored nyob rau hauv ib tug muab qhov chaws code.

Nws tuaj yeem siv tau raws li ib txoj hauv kev kom cov cai tsuas yog siv rau cov folders tshwj xeeb, tab sis koj tuaj yeem tsim cov ntaub ntawv GITIGNORE thoob ntiaj teb uas siv rau txhua qhov chaw cia Git koj muaj.

Koj tuaj yeem pom ntau qhov piv txwv ntawm GITIGNORE cov ntaub ntawv uas tau pom zoo hauv ntau yam xwm txheej, los ntawm GitHub's.gitignore templates nplooj.

How to open a GITIGNORE File

Image
Image

GITIGNORE cov ntaub ntawv yog cov ntawv nyeem yooj yim, txhais tau tias koj tuaj yeem qhib ib qho nrog txhua qhov kev pab cuam uas tuaj yeem nyeem cov ntawv nyeem.

Windows cov neeg siv tuaj yeem qhib GITIGNORE cov ntaub ntawv nrog cov kev pabcuam Notepad built-in lossis nrog daim ntawv thov dawb Notepad ++. Txhawm rau qhib GITIGNORE cov ntaub ntawv ntawm macOS, koj tuaj yeem siv Gedit. Cov neeg siv Linux (nrog rau Windows thiab macOS) tuaj yeem pom Atom pab tau rau qhib thiab kho cov ntaub ntawv GITIGNORE.

Txawm li cas los xij, GITIGNORE cov ntaub ntawv tsis tuaj yeem siv tau tiag tiag (piv txwv li lawv tsis ua haujlwm raws li cov ntaub ntawv tsis quav ntsej) tshwj tsis yog lawv tau siv nyob rau hauv cov ntsiab lus ntawm Git, uas yog dawb software uas khiav ntawm Windows, Linux, thiab macOS.

Koj tuaj yeem siv GITIGNORE cov ntaub ntawv los ntawm kev tso nws nyob qhov twg nws yog qhov koj xav tau cov cai siv. Muab ib qho sib txawv hauv txhua daim ntawv teev npe ua haujlwm thiab cov cai tsis quav ntsej yuav ua haujlwm rau txhua daim ntawv tais ceev tseg. Yog tias koj muab cov ntaub ntawv GITIGNORE tso rau hauv lub hauv paus nplaub tshev ntawm qhov project cov npe ua haujlwm, koj tuaj yeem ntxiv tag nrho cov cai nyob rau ntawd kom nws siv lub luag haujlwm thoob ntiaj teb.

Tsis txhob tso cov ntaub ntawv GITIGNORE rau hauv Git repository directory; uas yuav tsis tso cai rau cov kev cai siv txij li cov ntaub ntawv xav tau nyob rau hauv daim ntawv teev npe ua haujlwm.

GITIGNORE cov ntaub ntawv muaj txiaj ntsig zoo rau kev sib qhia cov cai tsis quav ntsej nrog lwm tus uas yuav clone koj lub chaw cia khoom. Qhov no yog vim li cas, raws li GitHub, nws yog ib qho tseem ceeb uas yuav tau cog lus rau hauv koj qhov chaw cia.

How to convert To/From a GITIGNORE File

Saib cov kab dhau los no rau cov ntaub ntawv ntawm kev hloov CVSIGNORE rau GITIGNORE. Cov lus teb yooj yim yog tias tsis muaj ib qho kev hloov pauv cov ntaub ntawv uas tuaj yeem ua rau koj, tab sis tej zaum yuav muaj ib tsab ntawv koj siv tau los luam cov qauv ntawm cov ntaub ntawv CVSIGNORE.

Saib Yuav Ua Li Cas Hloov SVN Repositories rau Git Repositories kom pab ua qhov ntawd. Tsis tas li ntawd, saib cov ntawv Bash no uas tej zaum yuav ua tiav ib yam nkaus.

txhawm rau txuag koj cov ntaub ntawv GITIGNORE rau hauv cov ntawv nyeem cov ntaub ntawv, siv ib qho ntawm cov ntawv nyeem tau hais los saum toj no. Lawv feem ntau tuaj yeem hloov mus rau TXT, HTML, thiab cov ntawv nyeem zoo sib xws.

Kev Nyeem Ntawv Qib Siab ntawm GITIGNORE Cov Ntaub Ntawv

Koj tuaj yeem tsim cov ntaub ntawv GITIGNORE hauv zos los ntawm Terminal, nrog cov lus txib no:

kov.gitignore

Lub ntiaj teb yuav ua tau li no:

git config --global core.excludesfile ~/.gitignore_global

Xwb, yog tias koj tsis xav ua cov ntaub ntawv GITIGNORE, koj tuaj yeem ntxiv kev cais tawm rau koj qhov chaw khaws cia hauv zos los ntawm kev kho cov ntaub ntawv.git/info/exclude.

Nov yog ib qho piv txwv yooj yim ntawm cov ntaub ntawv GITIGNORE uas yuav tsis quav ntsej ntau cov ntaub ntawv tsim los ntawm lub operating system:

. DS_Store

. DS_Store?

._. Trashes

ehthumbs.dbThumbs.db

Ntawm no yog qhov piv txwv GITIGNORE uas tsis suav nrog LOG, SQL, thiab SQLITE cov ntaub ntawv los ntawm qhov chaws:

.log

.sql.sqlite

Muaj ntau cov qauv kev cai uas yuav tsum tau ua raws li txhawm rau ua raws li cov cai tsim nyog uas Git xav tau. Koj tuaj yeem nyeem txog cov no, thiab ntau ntxiv txog yuav ua li cas cov ntaub ntawv ua haujlwm, los ntawm GITIGNORE Documentation website.

Nco ntsoov nco ntsoov tias yog tias koj twb tau kuaj xyuas hauv cov ntaub ntawv kom tsis txhob ignored, thiab tom qab ntawd ntxiv cov cai tsis quav ntsej rau nws hauv GITIGNORE cov ntaub ntawv, Git yuav tsis quav ntsej cov ntaub ntawv kom txog thaum koj tsis quav ntsej nws nrog cov ntaub ntawv GITIGNORE. cov lus txib nram qab no:

git rm --cached nameofthefile

Koj cov ntaub ntawv tseem tsis qhib?

Yog tias koj cov ntaub ntawv tsis ua haujlwm zoo li tau piav qhia saum toj no, xyuas kom koj nyeem cov ntawv txuas ntxiv kom raug. Piv txwv li, yog tias koj tsis tuaj yeem qhib nws nrog cov ntawv nyeem lossis yog Git tsis paub cov ntaub ntawv, tej zaum koj yuav tsis cuam tshuam nrog cov ntaub ntawv GITIGNORE.

IGN yog lwm cov ntaub ntawv tsis quav ntsej tab sis nyob hauv RoboHelp Ignore List cov ntaub ntawv tsim los ntawm thiab siv nrog Adobe RoboHelp los tsim cov ntaub ntawv pab Windows. Thaum cov ntaub ntawv tuaj yeem ua haujlwm zoo sib xws - sau cov lus uas tsis quav ntsej los ntawm kev tshawb fawb los ntawm cov ntaub ntawv - nws siv tsis tau nrog Git thiab tsis ua raws li cov cai ntawm tib syntax.

Yog tias koj cov ntaub ntawv tsis qhib, tshawb xyuas nws cov ntaub ntawv txuas ntxiv kom paub tias nws nyob hauv hom ntawv twg kom koj tuaj yeem pom cov software tsim nyog uas qhib lossis hloov nws.

FAQ

    Kuv pom dab tsi hauv kuv GITIGNORE?

    Koj tuaj yeem qhib cov ntaub ntawv nrog koj tus kws kho ntawv xaiv. Koj tseem tuaj yeem siv git kos-tsis quav ntsej kab lus hais kom pom seb cov ntaub ntawv tshwj xeeb puas nyob hauv daim ntawv tsis quav ntsej.

    GITIGNORE thiab GITATTRIBUTES yog dab tsi hauv Visual Studio?

    Cov ntaub ntawv GITIGNORE teev cov khoom tsis tau taug qab los ntawm Git chaw cia khoom, thaum GITATTRIBUTES cov ntaub ntawv qhia txog yuav ua li cas los daws cov ntaub ntawv tshwj xeeb raws li lub npe. Koj tuaj yeem qhib thiab hloov ob cov ntaub ntawv hauv Visual Studio los ntawm Repository Settings > Ignore & Attributes Files

    Kuv yuav GITIGNORE ib daim nplaub tshev li cas?

    Yog tias koj xav tsis quav ntsej cov ntsiab lus ntawm cov npe tshwj xeeb, qhib koj cov ntaub ntawv GITIGNORE thiab ntaus folder_name /.

Pom zoo: