Sitemap
TDS Archive

An archive of data science, data analytics, data engineering, machine learning, and artificial intelligence writing from the former Towards Data Science Medium publication.

Follow publication

Member-only story

An easy way to understand GIT

7 min readNov 4, 2022

--

I have been using GIT for versioning my work repositories as many programmers and I wanted to make a review for the most used commands and their logic to have a deeper understanding. Here is a collection that I have made after some online tutorials and classes that I would like to share with you!

Image from unsplash.com
  1. Create a new branch
  • git branch new_branch_name
    git checkout new_branch_name
    (or git switch new_branch_name) or
  • git checkout -b new_branch_name or
  • git switch -c new_branch_name

2. Create a new branch with an old commit to continue working from there

git log  (to check the commit id)
git checkout id (to pass related commit)
git checkout -b new_branch_name commit_id (create a new branch with that commit)

3. Stage mechanism

You have files that you staged already (that are in your track zone), and you have some changes in these files that you didn’t stage and you wanna delete.

  • git restore filename or
  • git checkout filename to delete the changes in a specific file

and

  • git restore . or

--

--

TDS Archive
TDS Archive

Published in TDS Archive

An archive of data science, data analytics, data engineering, machine learning, and artificial intelligence writing from the former Towards Data Science Medium publication.