I'm trying to save my changes, using Git, before actually doing a push. This is so I don't lose my work if my system crashes.
I looked into git stash, which seems nice, but it appears that's just local, so that doesn't help.
I read that I should create a new branch and push that. Well, that's what I did, below, and when I went back to the master branch, my working files were no longer showing up.
I have two questions:
What did I do wrong?
Is there a better way to save changes before you're ready to push?
My attempt:
// In master, where I have work in progress, create and move to a new branch
git checkout -b branch1
// Stage, then push, the changes in the new branch
git add .
git commit -m "committing changes from new local branch"
git push
fatal: The current branch branch1 has no upstream branch.
// Create remote branch and push new local branch to it (changes now on server)
git push --set-upstream origin branch1
// Go back to master to work
git checkout master
// Uh oh, changes aren’t showing up back in master? Where did they go?
git status
On branch master Your branch is up-to-date with 'origin/master'. nothing to commit, working tree clean