Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Development Tools Git Basics Merging Merge Conflicts

JUSANG YOU
JUSANG YOU
7,857 Points

Difference between git add and git commit.

As far as I understand, "git add" commands makes changed file staging and "git commit" means final report like I changed something on specific file. right? Can we just do "git commit" without staing process?? If then, What type of problem can be caused?

Tony Brackins
Tony Brackins
26,686 Points

Hey Jusang,

You're correct. Git add, adds the files to staging, to later be committed. These can both be done together if it's easier for you. Just use git commit -a

JUSANG YOU
JUSANG YOU
7,857 Points

Thank you! Tony. It is been clear! :)

2 Answers

Andi Wilkinson
Andi Wilkinson
26,822 Points

git add adds a file to your project, git commit commits the changes to final you can also just use git commit -a use git status to check whats going on!

git add you are putting sought changes into the staging area and git commit you are now effecting all the chenges rendered complete of a file in the targeted repository