Learn Most Common Git Commands

Published on : July 26,2022
Learn Most Common Git Commands

Version control (sometimes referred to as source control) plays an important role in any development project, including test automation. It is the practice of tracking and providing control over changes made in the source code. And since one of the most common tools used in version control is Git, let’s get to understand some of the most common Git commands.

 

What are Git Commands?

Git commands are a distributed version control system for tracking changes in any set of files. They were originally designed for coordinating work among programmers who were operating source codes during software development.

Git is a fast, scalable, and distributed revision control system with an unusually rich command set that provides both high-level operations and full access to internals.

 

Benefits of Git

  • It’s free (and open-source): You can freely contribute to the code any time and, of course, you don’t need to purchase it, since it is open-source.
  • Performance: It is faster and more reliable than any other version control software as it focuses only on file content rather than on file names.
  • Security: Git protects the code and the change history through a cryptographically secure hashing algorithm, called SHA1.
  • Widely-used: Git has become the preferred VCS tool in many great organizations.



Most Common Git Commands

Using git –help in the command prompt (on Windows), terminal (for Mac), or shell (on Linux) will give you a list of the available Git commands:

Let’s look over some of the most useful Git commands and understand them:

git clone

This command is used for downloading the latest version of a remote project and copying it to the selected location on the local machine. It looks like this:

git clone <repository url>

 

To clone a specific branch, you can use

git clone <repository url> -b <branch name>

 

git fetch

This Git command will get all the updates from the remote repository, including new branches.

 

git checkout

You can use the checkout command to switch the branch that you are currently working on.

git checkout <branch name>

If you want to create a new branch and switch to it, you can do it by using this command:

git checkout -b <branch name>

 

git init

This is the command you need to use if you want to start a new empty repository or to reinitialize an existing one in the project root. It will create a .git directory with its subdirectories. It should look like this:

git init <repository name>

 

git commit

This one is probably the most used Git command. After changes are done locally, you can save them by “committing” them. A commit is like local a snapshot of the current state of the branch, to which you can always come back. To create a new commit, type this command in Git Bash:

git commit -m "<commit message>"

If all goes well, you will see the changes in the commit.

git push

Git push will push the locally committed changes to the remote branch. If the branch is already remotely tracked, simply use it like this (with no parameters):

git push

If the branch is not yet tracked, and only resides on the local machine, you need to run the command like this:

git push --set-upstream <remote branch> <branch name>

 

git diff

You can use this command to see the unstaged changes on the current branch. Here’s an example of a branch with an edited feature file:

If you want to see the staged changes, run the diff command like this:

git diff --staged

 

Or you can compare two branches:

gif diff <branch1> <branch2>

 

git pull

Using git pull will fetch all the changes from the remote repository and merge any remote changes in the current local branch.

 

git add

This is the command you need to use to stage changed files. You can stage individual files:

git add <file path>

Or all files:

git add .

 

git branch

Using git branch will list all the branches of the repository:

Or you can use it to create a new branch, without checking it out:

git branch <new branch>

To delete a branch, run it like this:

git branch -d <branch name>

 

Conclusions

Git can be a really powerful tool in any development project and you will probably use most of these commands on a daily basis if your team uses Git for version control.

Categories : Git

Tags : git

Praful Sangani
Praful Sangani
I'm a passionate full-stack developer with expertise in PHP, Laravel, Angular, React Js, Vue, Node, Javascript, JQuery, Codeigniter, and Bootstrap. I enjoy sharing my knowledge by writing tutorials and providing tips to others in the industry. I prioritize consistency and hard work, and I always aim to improve my skills to keep up with the latest advancements. As the owner of Open Code Solution, I'm committed to providing high-quality services to help clients achieve their business goals.


162 Comments

purchase fenofibrate sale tricor order online tricor pills


generic tadalafil sildenafil 50mg over the counter sildenafil over the counter


buy acarbose sale buy cheap generic repaglinide fulvicin 250mg brand


dipyridamole 100mg ca gemfibrozil 300 mg canada order generic pravachol


meloset 3 mg sale norethindrone 5 mg pill buy danocrine 100 mg generic


buy florinef pills for sale florinef without prescription brand imodium


buy dydrogesterone sitagliptin 100mg over the counter jardiance pills


order prasugrel online cheap cheap detrol 2mg detrol where to buy


etodolac 600 mg generic buy monograph generic order pletal 100 mg pills


buy ferrous 100 mg without prescription buy ascorbic acid 500mg for sale buy betapace 40mg generic


pyridostigmine over the counter buy feldene paypal generic rizatriptan


enalapril 10mg pills doxazosin 2mg over the counter buy lactulose generic


cheap betahistine xalatan brand order probenecid 500 mg pills


buy zovirax medication xalatan drug buy rivastigmine online cheap


cost omeprazole 10mg order singulair 5mg without prescription generic metoprolol


premarin ca buy premarin online real viagra pharmacy prescription


buy telmisartan 80mg generic purchase hydroxychloroquine generic order molnunat 200 mg


buy cenforce 100mg generic chloroquine 250mg cheap chloroquine ca


usa cialis overnight order tadalafil 10mg generic generic viagra


omnicef 300 mg price buy glycomet without a prescription prevacid 30mg cheap


modafinil 200mg pills brand prednisone 20mg prednisone 5mg brand


buy accutane 40mg pill buy azithromycin paypal zithromax 500mg over the counter


purchase lipitor generic lipitor 20mg brand amlodipine medication


azithromycin 500mg cost azipro for sale online order neurontin online cheap


online poker sites blackjack free online oral furosemide


protonix 40mg for sale purchase pantoprazole online cheap purchase pyridium online


internet roulette blackjack free online brand albuterol


buy amantadine tablets avlosulfon over the counter buy dapsone medication


roulette free play for fun casino moons online casino stromectol ivermectin buy


playing poker online for money buy augmentin 1000mg generic levoxyl online


methylprednisolone 8mg pills order aristocort 4mg online triamcinolone online buy


clomiphene 50mg cost imdur 40mg canada imuran 50mg canada


buy cheap levitra buy lanoxin generic order tizanidine


buy aceon 4mg generic purchase clarinex without prescription buy fexofenadine 120mg online cheap


phenytoin over the counter purchase oxytrol online oxybutynin 5mg for sale


purchase loratadine online claritin 10mg price priligy 30mg cheap


buy ozobax pills order toradol pills ketorolac where to buy


baclofen 10mg drug endep 50mg pill buy generic toradol for sale


buy amaryl medication purchase amaryl without prescription etoricoxib 60mg generic


buy alendronate generic buy nitrofurantoin 100 mg sale buy macrodantin sale


inderal 20mg uk propranolol for sale clopidogrel over the counter


order pamelor for sale buy paracetamol 500mg online cheap buy generic panadol 500mg


orlistat pills cheap asacol 400mg order diltiazem 180mg generic


buy coumadin 2mg generic brand warfarin 2mg cheap reglan 10mg


buy generic azelastine for sale buy azelastine for sale buy generic avalide


buy pepcid 20mg famotidine 20mg cheap cost tacrolimus


order nexium 40mg online cheap nexium 40mg over the counter purchase topiramate sale


order zyloprim for sale order zyloprim 300mg for sale brand rosuvastatin 10mg


cheap sumatriptan imitrex 25mg drug order avodart 0.5mg pill


buspar 5mg for sale buy buspin paypal cordarone 100mg usa


ranitidine 150mg sale zantac 300mg tablet buy celecoxib 100mg for sale


order domperidone 10mg without prescription motilium 10mg price buy sumycin tablets


flomax 0.2mg pills ondansetron 8mg for sale buy simvastatin 10mg without prescription


write research paper for me help with writing a paper writing essays for money


buy spironolactone 100mg without prescription brand valtrex 1000mg finpecia medication


buy sildenafil without prescription sildenafil 200 mg buy yasmin cheap


diflucan 100mg drug cheap ciprofloxacin ciprofloxacin over the counter


generic lamotrigine generic minipress 2mg order nemazole pills


flagyl 400mg for sale buy cephalexin for sale cephalexin 500mg canada


retin ca buy avana pills for sale buy avanafil no prescription


buy clindamycin tablets buy cleocin 150mg pill fildena 100mg canada


tamoxifen 10mg us order budesonide without prescription buy generic symbicort


where to buy tadacip without a prescription buy voltaren purchase indomethacin pills


buy cefuroxime 500mg for sale buy bimatoprost generic methocarbamol without prescription


buy lamisil online no deposit real money casino slots online


trazodone 50mg canada desyrel over the counter cost clindamycin


aspirin 75 mg cheap online gambling real money wind creek casino online play


paperwriter guidelines for writing an essay suprax 100mg without prescription


pay for essay gamble online win real money best online casinos that payout


trimox 250mg uk order biaxin 250mg online cheap generic biaxin 250mg


calcitriol 0.25 mg ca tricor 200mg generic fenofibrate online order


clonidine price clonidine without prescription order tiotropium bromide online


best acne treatment for adults strongest acne over the counter trileptal 300mg canada


minomycin medication cheap minocycline ropinirole 2mg cheap


buy alfuzosin without prescription best drug to treat reflux best medicine in stomach pain


letrozole for sale online abilify over the counter aripiprazole 20mg cost


strongest sleeping pills online virtual weight loss clinic safest prescription weight loss medication


purchase provera without prescription hydrochlorothiazide 25mg pills order microzide 25mg for sale


new rx anti smoking drug non prescription smoking cessation products pain oapiods drugs list


generic cyproheptadine luvox usa ketoconazole 200 mg pills


antiviral drugs list will valacyclovir stop shingles diabetic pills type 2


buy cymbalta 40mg pills buy cymbalta no prescription buy provigil 100mg for sale


best supplement for internal fungus acyclovir for herpes simplex 1 get blood pressure prescription online


buy phenergan pill best place to buy ed pills online ivermectin 6 mg pills for humans


how are stomach ulcers spread buy uti medication no insurance order antibiotics online for uti


cheap prednisone 10mg prednisone 20mg us order amoxicillin 500mg


birth control refill online monophasic birth control order online how long does tadalafil last


supplements to help digestive system medications that stop vomiting best otc med for flatulence


how to buy zithromax buy prednisolone no prescription buy generic neurontin over the counter


ursodiol 300mg for sale order cetirizine 10mg sale purchase cetirizine pill


buy atomoxetine generic buy strattera generic order sertraline 50mg online


order furosemide online cheap order ventolin order albuterol sale


buy escitalopram buy sarafem for sale buy revia pills


order augmentin 375mg generic levoxyl online order oral clomid 50mg


buy combivent online buy decadron 0,5 mg generic buy linezolid 600mg online cheap


buy levitra 10mg generic cheap tizanidine 2mg buy hydroxychloroquine sale


buy cheap nateglinide purchase starlix pills order atacand 8mg without prescription


brand tegretol 400mg cheap carbamazepine 400mg order lincomycin


cenforce 50mg cost cheap cenforce purchase glucophage sale


lipitor brand amlodipine 10mg without prescription purchase lisinopril generic


purchase cefadroxil online cheap cefadroxil over the counter buy generic combivir for sale


order prilosec 20mg for sale buy prilosec no prescription where can i buy tenormin


oral dostinex 0.25mg order cabergoline generic brand dapoxetine 90mg


buy depo-medrol canada oral methylprednisolone how to get desloratadine without a prescription


misoprostol 200mcg canada misoprostol 200mcg pills buy diltiazem online cheap


order nootropil online cheap betnovate 20gm uk order anafranil 50mg online


zovirax 400mg for sale buy acyclovir online cheap where can i buy rosuvastatin


buy itraconazole no prescription order tinidazole online cheap purchase tinidazole online


buy generic ezetimibe over the counter order ezetimibe buy generic tetracycline


buy zyprexa 10mg sale diovan 80mg without prescription valsartan online order


order generic cyclobenzaprine buy ozobax generic toradol sale


buy colcrys paypal methotrexate cheap methotrexate 10mg brand


best contraceptive pills for acne oral mupirocin best acne treatment for boys


how long do antihistamines take to work generic albuterol antihistamine generic names


medicine for stomach acid problems order allopurinol 100mg for sale



prednisone 20mg us prednisone 20mg price


prescribed medication for stomach pain order irbesartan 300mg generic


best topical acne medication prescription mupirocin ca pills to clear acne


what is allergy medicine called buy medrol 4mg online best generic allergy pills


nausea medication list rulide 150mg drug


Другу удался важный шаг в карьере, и я решил поздравить его. Букет от "Цветов.ру" был идеальным подарком – стильный и насыщенный. Рекомендую сервис за отличное сочетание качества и быстрой доставки. Советую! Вот ссылка https://covideducation.ru/murmansk/ - цветов.ру


buy isotretinoin pills for sale order generic accutane 20mg buy generic accutane online


amoxicillin ca amoxil 250mg for sale cheap amoxil sale


buying sleeping tablets on internet provigil 200mg pills


order azithromycin 250mg pills purchase azithromycin sale where can i buy azithromycin


order gabapentin 800mg sale gabapentin 800mg tablet


azithromycin 500mg cost order azipro 500mg for sale buy azipro pill


furosemide 100mg pill lasix 100mg for sale


prednisolone without prescription omnacortil generic purchase omnacortil without prescription


order amoxil sale amoxil 250mg brand buy generic amoxil


order doxycycline generic acticlate brand


albuterol inhalator canada albuterol inhalator for sale how to buy albuterol


order augmentin 625mg order amoxiclav


cheap levothroid how to get levothyroxine without a prescription synthroid 150mcg for sale


levitra 20mg for sale order vardenafil 10mg


order clomid 50mg sale clomiphene uk clomid price


buy tizanidine paypal zanaflex drug generic zanaflex


Переход на здоровое питание потребовал от меня покупки шнековой соковыжималки. 'Все соки' предложили идеальный вариант. С их помощью я начал делать полезные соки каждый день. https://h-100.ru/collection/shnekovye-sokovyzhimalki - Шнековая соковыжималка стала неотъемлемой частью моего утра!


order semaglutide 14mg pill semaglutide 14mg without prescription cheap semaglutide 14mg


oral deltasone 20mg buy prednisone 20mg pills order deltasone 10mg online


semaglutide 14mg price rybelsus 14 mg canada buy rybelsus without prescription


isotretinoin 10mg over the counter order isotretinoin generic order absorica


buy amoxil 250mg sale order generic amoxil 500mg order amoxicillin pill


ventolin 4mg usa best antihistamine for allergic rhinitis order albuterol inhalator generic


zithromax us azithromycin 500mg brand zithromax 250mg cost


purchase amoxiclav how to get augmentin without a prescription purchase augmentin pill


omnacortil 5mg pill generic prednisolone generic prednisolone 5mg


synthroid 150mcg over the counter buy synthroid 75mcg generic synthroid 75mcg without prescription


order semaglutide 14 mg pills buy semaglutide 14 mg online buy semaglutide 14 mg without prescription


slots games free free blackjack blackjack online free


order vardenafil 10mg sale order vardenafil levitra 20mg usa


order pregabalin 75mg pill buy pregabalin purchase lyrica for sale


plaquenil 200mg uk hydroxychloroquine drug buy hydroxychloroquine 200mg


oral aristocort cheap aristocort 4mg aristocort 10mg oral


buy cialis 10mg sale cialis 5mg us generic tadalafil 20mg


desloratadine 5mg canada purchase clarinex buy desloratadine without prescription


cenforce 50mg sale purchase cenforce online cheap cenforce 50mg usa


loratadine pills claritin 10mg price loratadine buy online


order chloroquine online chloroquine cheap buy aralen 250mg online cheap


glucophage 500mg ca buy generic glycomet 1000mg purchase glycomet generic


oral orlistat 120mg buy diltiazem 180mg pill buy diltiazem online


Leave a comment

We'll never share your email with anyone else. Required fields are marked *

Related Articles