This is my first time running a project using git, so I will describe my set up and what I am trying to do.
Hopefully someone will be able to tell me how to do what I am trying to achieve, or how to set up differently in a more standard way.
I have a dev website that I have created a repository on.
I cloned a bare version of that repository onto the server
and have cloned repositories of the bare onto our local machines.
So my process is, pull from bare repository (named remote origin) to ensure that everything is up to date.
Make changes on my local working copy.
Commit the changes then push to origin.
So we have a bare repository which tracks all of the changes that we make locally.
I then want to pull those changes from origin to the dev website (repository has been named as a remote on my machine as dev)
What I thought I would be able to do is pull from origin to dev from my local machine as they both have remote aliases, but either it is not possible or I have not found the correct syntax. What I am having to do is ssh into the dev repository and pull the changes there.
Being able to work with remotes in this way will allow me to pull to dev, ensure everything works on the server then set up the live domain as a remote and pull to there.
The reason I am doing it this way is in my research everyone keeps telling me that you should only ever push to a bare repository, so I have set up a bare for everyone to push to so we can pull down into different locations.
Does this set up make sense?
is there a way to achieve what i am trying to do easily?
Is there a more efficient or standard way of setting up?
I did not get everything but you basically have two remotes,
devandorigin. What you want is take the code onoriginand push it todev, I suppose.So you can create branch
originbranchbased onorigin, from what you want (desiredbranch) :git branch --track originbranch origin/desiredbranchThen the same from
dev:git branch --track devbranch dev/desiredbranchTo make sure you are working on it :
git checkout devbranchThen merge it :
git merge originbranchAnd finally push it to
dev:git push devAnd I suppose that’s what you want to do.