0

I was in GitBash and did "git add file" and "git commit -m "msg"" and "git push --all origin".

It pushed branches to the work GitHub Repository that I didn't want pushed (some mix up of old things from a different username).

I looked at the branches and a few files were there from my personal computer.

I clicked "branch" on the repository's front page, and deleted those branches that just got put into GitHub.

Did I successfully permanently delete those branches and all files so no coworkers can any longer see it? It seems the branches were never pulled based on below.

Also, when I did the push command, it said:

"delta compression using up to 8 threads" "writing objects : 100% (122/122)" "Total 122 (delta 7)" "remote: create a pull request for 'branchname' on GitHub" "[new branch] branch name --> branch name" "! [rejected] main --> main (fetch first)"

I'm concerned about this because there were only a few files in the branches that got to the repository, but this above makes it appear 122 objects were put into the branches. So I'm concerned I did not delete things I am not seeing that I pushed into the repository. Or is that probably not in the repository because of the "[rejected]" line?

Any help please? I just want to ensure no private life stuff goes into a work repository. Thanks. I'm not too bright on GitHub yet.

2 Answers2

1

"Objects" are the internal Git database thingies1 that make up commits, trees, files, and tags. The fact that git push pushed 122 of them means that your Git had 122 thingies that their Git did not have.

Some of these thingies are actually files, and others are supporting objects. How many are which is not something anyone can say without more information. Each object has a type, and a raw hash ID—those big ugly hexadecimal numbers—that will let a Git retrieve the internal object, given the number and direct access to the repository. That is, the Git programs on GitHub could get them, if you know the numbers.

When you deleted the corresponding branch names on GitHub, you made it extremely difficult for anyone who did not already have the numbers, to find the numbers. However, the objects themselves are still there in the GitHub repository, and if someone can somehow guess the numbers, they can find them.

The "rejected" message means that some of those objects—the ones that would have gone into the GitHub repository and been findable through the main branch—didn't go into the GitHub repository. GitHub stores objects in a temporary "quarantine" area, in case they're going to reject large (> 100 MB) files, and then they drop all the quarantined objects that didn't get stored. So some of the 122 didn't go in. How many of the 122 never went in at all, and how many are just impossible to find now, is not something anyone can tell you.

Someone at GitHub can make the GitHub repository eject any objects that did go in, via the branch names that you successfully created or updated but have since deleted. To make this happen, you need to get someone at GitHub Support to act on your behalf.


1Thingy, noun: highly technical term.

torek
  • 448,244
  • 59
  • 642
  • 775
  • based on your assessment it seems like you think i am pretty safe that all the personal files are deleted and can't be seen by a coworker? do you think so? only one other person (the manager) has access to the repository and there is no way he was on it at the time or few minutes of the situation i described. how can i find a description of which are files and which are supporting objects? thanks! – addicted2coding Sep 18 '21 at 01:29
  • You're *pretty* safe: someone with access would have to work very hard to find the files on GitHub. Unfortunately there's no simple way to find out which objects that got sent *and retained* were file objects. You might be able to do it by doing the push again while using tracing software to capture the entire dataflow, then spending a couple of months analyzing that data, but it's probably not worth doing. – torek Sep 18 '21 at 03:05
1

[rejected] main --> main (fetch first)

means that main in your local clone was behind the origin main branch, and as the message says before pushing your local main to origin you should have pulld first. This means that you didn't modify the origin main branch.

As for the other branches, once you delete them from github they're gone, AFAIK.

Unless, of course, someone did a git pull before you could remove them...

Marcello Romani
  • 2,967
  • 31
  • 40
  • 1
    based on your assessment it seems like you think i am pretty safe that all the files are deleted and can't be seen by a coworker? only one other person (the manager) has access to the repository and there is no way he was on it at the time or few minutes of the situation i described. – addicted2coding Sep 18 '21 at 01:29
  • I would say so. But then when writing this answer I did some more research, and came across this https://stackoverflow.com/questions/17929891/for-how-long-can-you-restore-recover-a-deleted-branch-on-github which I'm reading at the moment. – Marcello Romani Sep 18 '21 at 14:23
  • OK it looks like that answer covers the scenario where a pull request was created from a branch. My understanding is that if you deleted the branch from the UI without creating a from that branch PR you should be safe. – Marcello Romani Sep 18 '21 at 14:28
  • sounds great. thank you! what a relief haha – addicted2coding Sep 18 '21 at 17:31