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

Should changes made to a branch in git show up on the master?

I'm still trying to figure out how to use git. I have it initialized on a project, and I've created a new branch, use_laser_delimiter. Just to test the new branch, I created a file named test.php after checking out the "use_laser_delimiter" branch. The command, git status, shows that the test.php file hasn't been added to the staging area. When I switch immediately back to the master branch and run 'git status', it also shows that a new file, test.php, hasn't been staged yet.

My understanding of git is that changes made to branches should be kept separate from the master branch until I merge those changes with the master branch. If that is correct, why would the test.php file show up when running 'git status' from the master branch?

1 Answer

Mikkel Rasmussen
Mikkel Rasmussen
31,772 Points

As long as the files hasn't been committed or added while you are on the branch they will still show up when you does git status.

Thanks, Mikkel. After I committed the change in the use_laser_delimiter branch, the test.php file no longer showed up in the master branch.