Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GitHub branch syncing with the master for no obvious reason

I'm coding in Rstudio and my workflow is along these lines:

  1. make a new branch using Rstudio's UI
  2. add some code or fix a bug
  3. commit code when I'm satisfied and push to GitHub
  4. merge the new code into the master on GitHub
  5. pull the latest master code from GitHub into Rstudio using it's UI
  6. delete any local/remote branches via command line (because Rstudio doesn't have the functionality and doesn't sync with GitHub when it comes to remote branch deletion)

This might not be the most efficient way of doing things (I'm new to git) but it works well enough except for the problem I'm having. Twice now, seemingly at random, I've created a new branch, worked on it and when I've gone back to check something in the master they are identical. The code changes I've made in the branch have already synced with the master.

This is what the last two lines of the History look like:

git history

independant_erp_norm_regressions is the last branch I merged into the master while preprocess_select_global_pars is the current branch which is syncing to the master unduly.

I'm at a loss as to what is going on because I'm doing the same thing as I usually do and haven't been able to find any similar questions on stackoverflow.

Any help would be greatly appreciated (as well as any ways in which I can streamline my workflow).

like image 986
Matt.M.888 Avatar asked Feb 20 '26 02:02

Matt.M.888


1 Answers

Ok thanks for the responses guys, as per Tim's reply I decided to commit the changes made to the new branch via Rstudio's UI and check in command line to see what happened behind the scenes. (After that I thought I would do an entire branch/merge via command line to see if the problem persisted or if it was a Rstudio bug). So just before committing the changes Rstudio's git interface showed that Master and my branch were still in sync up to and including having staged files selected together. After committing I used "git show-branch" in command line and it showed that only the correct branch had a new commit, this was mirrored in Rstudio's Git history interface and after merging via GitHub all is well. So it seems like it was just an Rstudio-git bug of sorts.

like image 95
Matt.M.888 Avatar answered Feb 21 '26 15:02

Matt.M.888



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!