09-29-2024 09:53 PM
Hello,
Could someone please advise on the best practice how to push local repo to remote repo [Github].
Thanks,
09-30-2024 12:45 AM
Hi @Netmart
Just google for "git tutorial" or "github tutorial" there are plenty of free resources available (for example https://product.hubspot.com/blog/git-and-github-tutorial-for-beginners).
Assuming you want to push from your local remote to your remotes repo main branch:
cd /path/to/your/local/repo
git add .
git commit -am "some message describing your changes"
git push -u origin main
10-01-2024 03:31 AM
When working with a remote repo such as GitHub or Gitlab, what I always do is to create the repo there first. Once the repo is done, I clone it and start working locally. Once I have my changes done, I push them.
You could do the same in other ways, but this is the flow that works for me. I don't need to git init and then when pushing specifying the origin and main (vscode takes care of that for me).
So I recommend, explore several ways and stick to the one method you find easier.
As a tip, remember to always work with branches. Don't push to your main branch, prefer merge.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide