I'm working with several repositories
origin : the remote repository
back : which is a backup of the repository on my local PC
uptreams : repository for later pull request
git remote -v back /opt/lampp/htdocs/work/repo_backup/webtrees (fetch) back /opt/lampp/htdocs/work/repo_backup/webtrees (push) origin https://github.com/ckl67/webtrees.git (fetch) origin https://github.com/ckl67/webtrees.git (push) upstream https://github.com/fisharebest/webtrees.git (fetch) upstream https://github.com/fisharebest/webtrees.git (push)
Locally In my "git directory" I'm working with several branches
- master
- work
- dev
In my "git directory" I'm working in branch "work" because I want not to interfere with the "master" branch
My repository "back" is used to test the software. This "local" repository is used to ftp the (html,php,javascript) code to a local directory for test (Apache,mysql local server)
When I push to repository "back"
git push back
All my branches will be pushed too By default repository "back" will point to branch "master"
So this means that I cannot test my code. For that I have to go to repository "back",
checkout work
"test"
checkout master
Because, I have seen that it is not possible to "git push back" when on my repository "back", the branch "work" is activated !!
So I'm a bit in a trouble here.
Question 1) It is possible to checkout remotely a branch ?
From my "git directory" to checkout branch "work" of my repository "back" ? So principle would be from my "git directory"
git push back
--> checkout to "work" in repository "back
* perform test --> ftp to my local directory in order to test
--> checkout back to "master" in repository "back
git push back :: to update all branches (master/work/dev)
Solution 2) It is possible to link git directory/work --> back/master Meaning, when I "git push back", back/work will be updated I have tested
git branch --set-upstream-to=back/master work
But it didn't work
git branch --set-upstream-to=back/master work
The 'work' branch is set to follow the remote 'master' branch from 'back'.
/opt/lampp/htdocs/work/webtrees $ git push back fatal: The upstream branch of your current branch does not match
with the name of your current branch
Certainly because, in the "repository back" I have
git clone --depth 1 https://github.com/ckl67/webtrees.git
Thank You