Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How do I undo rebased current changes onto branch?

s October 13, 2024

I thought it was source trees version of "update from main" by the fact its trying to push changes onto main that was an incorrect assumption I have not pushed the changes how do i remove the changes it is now trying to push?

 

 

 

 

I currently have 5 things trying to be pushed onto main how do I get it to just forget about everything and give me whatever the remote thinks main is right now and nothing else I do not care about losing any work on my end

2 answers

1 vote
s October 13, 2024

I currently have 5 things trying to be pushed onto main how do I get it to just forget about everything and give me whatever the remote thinks main is right now and nothing else I do not care about losing any work on my end

s October 13, 2024

ah crap how do i delete this?

0 votes
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 15, 2024

Hi @s and welcome to the community!

If I understand correctly, you want your local branch main to point to the commit that the remote branch main points to.

You said you don't care about losing work. However, I still recommend you save the current state of local main into a new branch, in case you change your mind later. The last command in the steps I provide below includes a destructive operation, so it's best to have a backup of main.

You can do the following:

1. Open a terminal application and navigate to the clone directory.

2. Run

git status 

to check which branch you are currently on.

If it is not main, run

git checkout main

3. Run

git status 

again. If there are changes you haven't committed yet, add them and commit them.

4. Create a new branch out of main so that you don't lose any work, with

git branch some-branch-name

where some-branch-name replace with the name you want for the new branch.

5. Run the command

git remote -v

The output will show you the name and URL of the remote, e.g.:

origin git@bitbucket.org:workspace-id/repo.git (fetch)
origin git@bitbucket.org:workspace-id/repo.git (push)

If the name of your remote is origin, fetch changes from the remote repo with

git fetch origin

6. Double check again that you are on the local main branch by running git status and checking the output. If you are, then run

git reset --hard origin/main

If you have followed all the steps and your currently checked out branch is main, the last command is going to make your local main point to the same commit as the remote main.

Please feel free to reach out if you have any questions.

Kind regards,
Theodora

s October 15, 2024

work on local is easy to re-implement the hard part was working it out but I have my implementation notes (and the changes were on the other branch I was trying to update to be in line with main anyway)

 

got it sorted though

 

someone else on my team had me just delete the local copy of main (with force delete) and then just checkout main again and that got rid of all the changes that were trying to be pushed to main without pushing them to main

 

I then just merged main into my branch (merge main into current branch) at their instruction sorted out the one conflict and It was all sorted

 

I may have panicked a bit though

Like Theodora Boudale likes this
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 15, 2024

Thank you for the update, it's good to hear that you got it sorted.

Please feel free to reach out if you ever need anything else!

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events