I need to locally rollback to a previous commit in sourcetree because code is missing from a deployment, but I do not want to lose all the work done that has been committed and pushed since that earlier commit.
I find sourcetree's terminology and options confusing and sometimes they don't work as I would expect them to.
How do I do rollback to get previous versions of files to make changes without losing the changes made recently? Thanks!
Don't worry. I think Sourcetree was playing up as when I reset my branch I could make the edit, deploy the DLL and then PULL all commits again.
The solution that you are probably looking for is called "rebasing". It's a method within git where you rewrite a portion of the git history.
However, this is a very bad approach if you've already pushed the commits you want to modify. The reason for this, is that rebasing essentially discards the old commits and creates new ones with new hashes. Any coworkers/team members that have pulled the unedited commits are going to start getting very strange error messages if they try to do any work in that branch, and will have to jump through a bunch of hoops to "repair" their local repositories.
The right solution is to just make a new commit that has the fix you need, and deploy that instead of whatever you are currently trying to deploy.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can select any commit and then select any file within that commit, right click, open selected version.
That will open the version of the file at the time of the selected commit. You can copy and paste changes to the current version of the file.
Without knowing the specifics of your project that's the best approach I can suggest.
In other scenarios you can reset a branch to a particular commit or reset just 1 file to how it used to be in a particular commit or cherry pick another commit onto your current branch or Reverse Commit to undo all changes that were introduced in a particular commit.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Why do you need to rollback? Just add the changes in a new commit.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.