Only need to commit certain files to Github? .gitignore to the rescue

Tracy Chen
1 min readApr 3, 2022

--

There may be certain files which you may not want to commit to Github — in these cases, you can designate the omitted files in a .gitignore file. Follow along in these two easy steps.

Open terminal and once you are in the folder with your Github repo ->

# create a .gitignore filetouch .gitignore# OR you can choose to use nano which will create the file (if it doesn't already exist and directly open for editing - very handy)nano .gitignore 

Within the .gitignore file add the file that you want to ignore.

# for example - I want my Python virtual environment to be ignored from my commit. Within the file, I've added streamlitVenv/

Follow the prompts on the bottom, to Exit (^X) and Save.

Next time you commit, the specified files will not be part of your commit.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Tracy Chen
Tracy Chen

Written by Tracy Chen

A product person who still dabbles in code.

No responses yet

Write a response