Kramer
Kramer

Reputation: 1058

git merge changes from head to local

I am pretty new to got and need some help. I apologize if my question is trivial or stupid.

Anyway, I synced from a remote branch, made some changes, checked some in, but others I never staged (because I don't want them checked in).

Now I need to sync to that remote repository, but not lose the local untracked changes. Ideally, it would be great if git would allow my to review changes if there are any conflicts.

Anyway, thanks for the help!

Upvotes: 0

Views: 152

Answers (2)

Learath2
Learath2

Reputation: 21343

Thats why you should always work with branches. Anyways you can git stash save your work and then git commit and git push. After that you can git stash apply to get your other changes back.

Upvotes: 1

Roman
Roman

Reputation: 20246

You can use the stash command to back up changes in untracked files, something like

git stash --include-untracked

The documentation link above provides an example called Pulling into a dirty tree, which is probably similar (or identical) to your situation. If there are merge conflicts when you try to apply stashed changes git will tell you.

Upvotes: 2

Related Questions