Adding here for my own purposes, but may be helpful to others. This rebases to master (or whatever branch) and then squashes all your commits into one commit! Sexy. 🙂
> git fetch --all
> git checkout [master]
> git pull
> git checkout [working branch name]
> git merge-base HEAD [master]
> git reset --soft [hash] e.g.: 43e87200b8375fc5eba022ced353ab2917f2a746
> git status
> git commit -a -m "NOTES"
> git rebase [master]
Note: Only needed if conflicts between branch commit and master
> git add .
> git status
> git rebase --continue
> git diff origin/[working branch name]
> git push -f origin [working branch name]
This is a post-in-progress.
To revert local commit:
git reset HEAD~1
To see what is about to be pushed:
git diff --stat --cached origin/master
In case you encounter this issue, do the following:
1. Preferences > SSH
2. Make sure SSH executable is set to “Native.” (If already so, switch to “Built-in,” apply it, then switch back to “Native.”)
3. Happy fetching!
I worked on upgrading a web service from JDK 1.6 to JDK 1.8 and was successful (that’s something I need to write a post on); however, I wanted to make sure I could revert back to pre-1.8 in case it breaks in production. The solution was to create a clone or duplicate of master before I merged the branch.
This would then allow me to merge that branch if needed. Here’s how:
git checkout -b java6-branch origin/master
And then, it needs to be pushed so others can access it:
git push origin java6-branch
That’s it. You can double-check by logging into your Git site. 🙂
P.S. Best practice is to name your branches in lowercase and in groupings (i.e. foo/bar1, foo/bar2).
Adding my .gitignore file so I can look it up in the future.
And then configure Git to use it globally by:
git config --global core.excludesfile ~/.gitignore