I
I
Ivan Artamonov2015-05-15 23:45:46
git
Ivan Artamonov, 2015-05-15 23:45:46

How in GIT to make it so that when you push to the bare repository, the changes are automatically applied to the main repository?

So, there is a dev-server with access to it via SSH. There are 2-3 programmers working on the same project through PhpStorm. There is a repository on the server and its --bare clone. The goal is to make changes automatically appear in the main repository when you commit from PhpStorm. Google easily suggests that this is done using hooks. In particular, by writing instructions on the bare repository in post-update like:

cd ../myProject
git stash
git pull

BUT! Branches not working! If I create a branch on my local machine, commit some changes to this branch and try to push, a message will appear like "Nothing to Push ..." or something like that ...
Explain to me a fool and a completely green newbie in git how to write a hook correctly so that you can push branches, or maybe I don’t understand something and no hooks are needed here at all. How to do it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
kompi, 2015-05-16
@aradon

Git has an execute option for a randomly located repo, i.e. "cd .." - can be removed.
You are trying to pull the main repo for the current branch, and since there were no changes on it, accordingly, nothing happens.
Those. you need to pull all the changes and checkout to the new branch.
PS Why is stash running at the main repo, who is "littering" there?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question