D
D
Dmitry2017-03-31 01:15:23
git
Dmitry, 2017-03-31 01:15:23

How to properly merge updates from a remote repository without overwriting changes in the local one?

There are 3 repositories: remote ( BitBucket ), production and local (developer).
The local one was cloned from the remote one and part of the code was changed in it, after which the changes were committed.
In the meantime, some production updates have been pushed to bitbucket.
How can I now get updates from BitBucket in the local repository without losing changes and then upload them back to BitBucket along with the changes ?
The second question: changes were made and a commit was made. How to return to the state before the commit, but with the changes saved? How to rollback to a state before a certain commit for a certain hash?
Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Melikhov, 2017-03-31
@amelihovv

1. git pull --rebase
2. git reset --soft HEAD~1
3. git checkout commit_hash

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question