You ARE probable on a different branch. You probable should back up your changes. Since folks are losing their changes, they need to always save to local repository, then save from the local repo to the remote repository. Merges are done from inside the target branch, which requires you to have saved your work to your source dev branch before merging with master.. Here are the steps.
is a git command
[ is something you need to change ]
First know what branch you are on..
- git branch
will tell you what branch you are on.
Then you need to check your code into your Dev branch so you don't lose it.
- git status
list the files that have changed
- git add [path filename]
add all the files which have changed just copy the path and file names from the status command you want to add.
- git commit -m ["comment"]
inserts your files to your local repository with a comment saying what you changed. The files inserted will the ones you added.
- git push origin [branch]
push your local changes from your local repository to remote repository for your dev branch.
Now your local and remote repositories are all in order.... If you want to update Master branch, You can safely check out that branch and merge from inside of master. If you are doing pull requests you'll probable want to create a new branch from master and merge with that. Then do the pull request on that new branch.
But if you aren't using pull requests and want to update master directly to your dev branch. First you check out master.
git checkout master
This will delete your local code but you have saved it both locally and to the remote server.. so you're good.
git merge [dev branch]
This will merge your dev code into master. If there are any conflicts then open the file which conflicted and search for the '>>>' string to see where the conflict is. resolve the conflict by correcting the code. Then check your changes in locally and then from the local repository to the remote repository.
git status
See what changed
- git add master
Add the modified files into the update
- git commit -m "[comment what changed]"
update the local repository
- git push origin [branch]
update the remote repository.. branch will be master here unlesss you are synking to a new branch in order to do pull request on it.