How to compare local files from files on the main branch on bitbucket?

Viewed 31

I want to copmare files which are on my computer with files on the main branch of git. Do I need just download files from git and with certain command compare them? After that I want to push my changes on the another branch "feature/add_button_component" on bitbucket. How it is better to do and what commands do I need?

1 Answers

Assuming .git folder was removed from your local repository.

  1. Obtain the clone URL from Bitbucket;
  2. Run git clone <CLONE_URL> <ANOTHER_DIRECTORY>;
  3. Copy over the updated files from <OLD_DIRECTORY> to <ANOTHER_DIRECTORY>;
  4. Switch to <ANOTHER_DIRECTORY> cd <ANOTHER_DIRECTORY>
  5. Run git diff to compare your local changes to what you have in the main branch;
  6. Run git switch -c "feature/add_button_component" to create the feature branch;
  7. Add your changes with git add -u, commit with git commit and push with git push.

This might not be the most elegant, but should be the easiest option.

Related