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

Caesar Bell
Caesar Bell
24,829 Points

Pull just one file instead of a whole directory ?

What is considered best practice when pushing and pulling repo , and could someone just push and pull one file out of a directory instead of the whole directory? I am working with a team member and we are using git repos to share our work, but sometimes I am just updated features on the front end and nothing to do with the back end would it be good practice to just pull the updated files instead of the whole directory?

1 Answer

Kevin Korte
Kevin Korte
28,149 Points

Git only pulls what has changed since the last commit. If there was only one file change in that commit, it's only going to pull that one file. It's smart enough to compare and contrast your current local repo with what the most recent remote repo.

You have to work out of a commit level though. You can't pull just one changed file of many out of a commit, otherwise it would become way to chaotic to track. And it doesn't really matter much, git is pretty fast.

If you wanted to, you could create a front end features branch to work out of, and just push/pull out of that. Your partner could have a back end branch he push/pulls out of, and when you're happy with where you are at, you merge your branch with the master.