Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I merge back into master without losing my work on github?

Tags:

git

github

I have never collaborated before and now find myself needing to share this project with a few others even though I will be doing 90% of the development.

I have a private repo on github. I pushed my initial source with

git push origin master

then i created a new local branch and made some changes. Then I did some stuff. (It kinda breaks down for me here.) Now, I would like to merge my branch back into master. Locally, it says they're both up to date but on github, it says my 'master' branch has a state of '3 behind'.

Some questions in no certain order?

How do I get my valid branch merged back into master without losing my work? How should I be doing this in the future?

like image 749
NJ. Avatar asked Dec 06 '22 22:12

NJ.


1 Answers

Step 1: Make sure all your changes are checked in.

Step 2:

git checkout master
git merge <your local branch>

Step 3:

git push origin master

And, if you want to continue working on your local branch, Step 4:

git checkout <your local branch>
like image 200
Jonathan Avatar answered Dec 11 '22 08:12

Jonathan