3

My company recently switched to a short lived feature branch workflow - and it's fantastic. My favorite new trick is that I can now "delete" any bad work I may have pushed accidentally. When I know that I just pushed the branch and no-one else has it, I can use git push origin :branch-name to kill it off and do whatever I want locally to fix up.

My question refers to situations where I haven't just pushed my branch. Say I wanted to rebase an old branch to a newer one, and don't want to deal with merge conflicts - if I were alone, I could just kill the remote branch as noted above, fix up, and re-create the remote - but is there a way to check if anyone else has pulled my branch since I pushed?

I don't want to delete/modify the remote copy of the branch if someone else has it - I know that's the big "No, don't do it" when it comes to git.

Matt
  • 1,674
  • 2
  • 16
  • 34

2 Answers2

3

There is no way to tell if someone has pulled your remote branch down from Github (or Bitbucket) since you've pushed it. When they do a pull (or fetch) of a particular branch, they'll have a local copy of that history -- that's it.

I also wanted to mention that in general, it's a really bad idea to remove branches (git push origin :branch) unless you're absolutely sure they are no longer needed =) For instance, if you're working on a feature branch, push it, open a pull request -- then the pull request is merged. Only then would you want to clean up (delete) your old feature branch.

rdegges
  • 32,786
  • 20
  • 85
  • 109
  • Unfortunate, but thanks for the answer - do you have a source that backs it up? Maybe nothing explicitly addresses it... – Matt Jan 05 '17 at 16:42
  • 1
    I don't have a direct source to quote, but if you look through your project's settings, you can view usage graphs, forks, etc. Note how there are no stats about clones / pulls. This is because you can anonymously grab info without even being a github user from a repo. There's nothing to stop public bots from crawling / grabbing things. It isn't feasible to track this info at a granular level. This might be of use: https://stackoverflow.com/questions/15181453/is-it-possible-to-find-out-the-users-who-have-checked-out-my-project-on-github – rdegges Jan 05 '17 at 19:11
0

You can have your coworker make a git server for their git repository, and add that git server URL to your git repository as a remote. Then, with a simple git fetch, you can see what branches they have and how.

noɥʇʎԀʎzɐɹƆ
  • 9,967
  • 2
  • 50
  • 67