Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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
28,674 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