0

My repository is set up in a way that when someone pushes on "branches", a CI system checks what has been pushed and then pushes back on "master". So, when someone pushes and pulls, it's on "branches". But if someone commits and push something wrong, it stays on "branches", and when someone else pulls, it drags in the bad things.

I found that I can change "git pull" and "git push" commands so that they pull/push from another branches than Master, but can I separate these two settings? How can I set my repository in a way that "git pull" = "git pull origin master" and "git push" = "git push origin branches"

Thanks in advance

3
  • I am completely unable to follow what you're doing. What do you mean, the CI system pushes back on "master"? And what do you mean, when someone else pulls, it drags in the bad things? At first glance, it seems like you're adding some unnecessary logic to git here. Commented Feb 13, 2014 at 15:26
  • Also, just as importantly - why did you do this? What was the underlying reason to have this special setup? Commented Feb 13, 2014 at 15:27
  • I push on "branches", a branch where lies good and bad code. CI checks the code, see if it's ok and push it on "master", the "good" branch. I did this to have a separation between a dirty workspace and a clean workspace (also no, I can't use 2 different repositories)
    – Mewster
    Commented Feb 13, 2014 at 15:29

1 Answer 1

1

I think you would be better off respecting the way Git works.

You can have your users explicitly pull from master and push to branches.

This way your history will make more sense in the long run no user will be confused by the hidden logic.

1
  • I know that's not a correct way to use git, but at this moment I can't change how the workspace has been set up
    – Mewster
    Commented Feb 13, 2014 at 15:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.