0

When deleting a branch from remote and local other people working in that repo are affected. If someone has the deleted branch local I guess they can push it back right?
How is this syncing handled?

Jim
  • 3,845
  • 3
  • 22
  • 47
  • What "syncing" are you referring to? – junkangli Apr 10 '18 at 09:32
  • @junkangli:Should others do any manual update in their local repo? – Jim Apr 10 '18 at 09:33
  • 1
    Possible duplicate of [How do I delete a Git branch both locally and remotely?](https://stackoverflow.com/questions/2003505/how-do-i-delete-a-git-branch-both-locally-and-remotely) – kvk30 Apr 10 '18 at 09:34
  • @kvk30: From your link seems that people need to run `git fetch --all --prune` in their machines? – Jim Apr 10 '18 at 10:21
  • @Jim yeah it was worked for me, If It didn't work for you let me know. – kvk30 Apr 13 '18 at 06:23

1 Answers1

1

When deleting a branch from remote and local other people working in that repo are affected. If someone has the deleted branch local I guess they can push it back right?

Yes, someone else who has the local branch, which got deleted in the remote, can push it to remote.

Git commit hash is actually a hash of the commit object that contains information including the hash of the commit before it. That is how the git commit history is generated.

Other people who also has the local branch will just need to set their remote tracking branch to the new "restored" branch, using the command:

git branch branch_name -u your_new_remote/branch_name
junkangli
  • 1,152
  • 7
  • 14
  • Are you asking for the command to change the upstream branch to be tracked? – junkangli Apr 10 '18 at 10:27
  • Ah so need for them to prune or something? – Jim Apr 10 '18 at 10:50
  • The `prune` option is to remove stale branches that no longer exist in the remote. The solution I provided replaces the old remote branch to the new one. So, people who want to continue working on that branch can use the command I provided, and people who do not want to continue working on that branch can prune the old branch. – junkangli Apr 10 '18 at 10:57