0

I have existing project: my-project on both DEV and QA. Now I'm thinking of creating git repo so I can push the changes from DEV so QA can pull the changes. I don't want to delete my-project from QA and clone my-project from DEV to QA. So I am planning to do this:

On Dev:

$cd ~/my-project
$git init
$git add .
$git commit -m "My project"
$git remote add --track master origin ~/my-project
$git push

On QA:

$ cd ~/my-project
$git init
$git remote add origin ssh://Dev:~/my-project
$git pull 

Will this work? Or do I miss anything? Any suggestions would be appreciated!

1 Answer 1

0

The idea is good (provided ssh://Dev does work)

All that is missing is a refspec in order to instruct your QA repo to fetch something (as explained in "How to understand remote “origin” fetch setting in .git/config file?"):

git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"

You can then do a git fetch, and then create a new local master branch

git switch -c master

That will track automatically origin/master, using the new (Git 2.23+) git switch command (see "Confused by git checkout").

From there, you can git pull at any time.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.