Git Remote Introduction
In this page:
git remote -v
git clone repository_url
git push remote_name branch_name
एक Git Remote क्या है?
एक remote बस आपकी repository की एक copy है जो कहीं और hosted है -- आमतौर पर GitHub जैसी किसी service पर -- जो उस shared meeting point की तरह act करता है जहाँ team members files को इधर-उधर email करने के बजाय commits exchange करते हैं।
उदाहरण: What is a Git Remote?
git remote -v
एक Repository Clone करना
एक repository clone करना सिर्फ इसकी files copy नहीं करता -- यह automatically source की ओर वापस एक remote connection (default रूप से origin नाम का) भी configure करता है, इसलिए आपकी local copy को पहले से पता है कि updates कहाँ से fetch करने हैं।
उदाहरण: Cloning a Repository
git clone https://github.com/user/repo.git
git remote -v
Remotes को Push करना
Pushing आपकी local commits को एक remote पर upload करती है, आपके काम को उस तक access रखने वाले हर किसी को visible बनाते हुए -- push करने तक, आपकी commits सिर्फ आपकी अपनी machine पर exist करती हैं, collaborators को invisible।
उदाहरण: Pushing to Remotes
git push origin main
Remotes से Pull करना
Pulling एक remote की नई commits download करता है और उन्हें एक step में आपकी इस समय checked-out local branch में merge कर देता है, जो है कि आप teammates के पहले से pushed changes के साथ कैसे sync रहते हैं।
उदाहरण: Pulling from Remotes
git pull origin main
Fetch बनाम Pull
Fetch और pull related हैं लेकिन distinct हैं: fetch सिर्फ नई commits download करता है और आपको यह decide करने से पहले उन्हें inspect करने देता है कि क्या करना है, जबकि pull उन downloaded commits को तुरंत आपकी current branch में भी merge कर देता है।
उदाहरण: Fetch vs Pull
git fetch origin
git pull origin main
- एक remote को एक URL से confuse करना, जबकि एक remote
originजैसा एक नाम है जो एक URL की ओर point करता है। - एक remote set करने से पहले
git pushचलाना औरNo configured push destinationपाना। - यह मान लेना कि एक remote automatically update होता है, जबकि local remote-tracking branches सिर्फ
git fetchयाgit pullके बाद बदलते हैं।
Chapter Quiz — Complete all 11 topics to unlock
0/11 topics done
Complete these topics first: