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

Mayur Pande
PLUS
Mayur Pande
Courses Plus Student 11,711 Points

Development branch behind master branch

I am following nvie's git branching model. However I ran into problems, as I had uploaded sensitive data to git hub. So using this link using git-filter-branch I removed the file and its history. Then I created a new file suggest.php and a separate config.php. However when I commited and merged these and then pushed them into git hub. It says my git hub development branch is 28 commits behind my git hub master branch.

So I then pulled both branches, to merge them locally on my machine however it seems to say everything is up-to-date, which is not the case. The master branch doesn't have the suggest.php file, or the .gitignore file in it.

1 Answer

Sue Dough
Sue Dough
35,800 Points

First off Security:

You have been 100% comprimised. Deleting the information is not enough. Change whatever passwords etc you need to change fast. If you use the same password for everything change every password you have.

Second:

It sounds like the issue is this. Your like hey git, let me do a git pull, and git is like okay. Git then gives you the git pull but its local. Its sounds like its pulling from your local host NOT GITHUB. You need to pull from the remote branch.

try:

git pull origin master

Let me know if that helps and if you get an error let me know what it is.

Also pro tip. Use a config-sample.php or config-sample.ini for git. Then put the config.php in the .gitignore so it can't be committed and will always work when you push/pull.

Mayur Pande
Mayur Pande
Courses Plus Student 11,711 Points

Hi thanks for the reply.

Regarding what you have said. I changed my passwords straight away.

I originally did try git pull origin master. But that didn't work.

So what I managed to was. Reset git to different commit using the sha1 code. Then ran git filter-branch. Then re-committed files that were taken out.

Also not quite sure what you mean with the config-sample.php. Do you mean add a file identical to the config.php with no values in it, so that whoever is pulling it can know to add their own sensitive data there?

Sue Dough
Sue Dough
35,800 Points

That is good to hear. I am glad you got it sorted.

Yes check WordPress config-sample.php as an example https://github.com/WordPress/WordPress . Notice how theres no config.php ? This way if devs download your code they can easily just make a copy of the original config and name it config.php . This way you can push/pull without losing the credentials or whatever set in that file. It also avoids people compromising themselves. It also gives you a place to find the original config.

Sue Dough
Sue Dough
35,800 Points

You can also include a helpful command in the readme in your repo to make things easier:

git clone https://github.com/yourusername/yourrepo && cp config-sample.php config.php

That will clone the branch and make a config.php copy from your sample.

Also just to reiterate make sure to put config.php in the .gitignore file.

:)