Is it possible in git to create a new, empty remote branch without pushing?

Most examples of creating remote branches involve pushing from a local branch

Is there a way of creating an empty remote branch without pushing?

  • Track someone's GitHub repo in a branch
  • What will git checkout master + git reset --hard do?
  • Why doesn't git allow me to safely delete a branch?
  • Rebasing remote branches in Git
  • How can I “git log” only code published to trunk?
  • How do you remove an invalid remote branch reference from Git?
  • Is it also possible to create a local empty branch,check it out then link it to the new also empty remote branch without pushing?

  • mercurial - see changes on the branch ignoring all the merge commits
  • git ignore everything but some subdirectories
  • Adding Folder/Subfolders/files in Git
  • Is running git update-index --refresh from PS1 prompt safe?
  • GIT - How to make a branch be the same as master
  • Temporarily clearing untracked files before commit in Git
  • 2 Solutions collect form web for “Is it possible in git to create a new, empty remote branch without pushing?”

    As mentioned in the blog post “Start a New Branch on your Remote Git Repository”:

    • Creating a Remote Branch
    git push origin origin:refs/heads/new_feature_name
    • Make sure everything is up-to-date
    git fetch origin
    • Then you can see that the branch is created.
    git branch -r

    This should show ‘origin/new_feature_name

    • Start tracking the new branch
    git checkout --track -b new_feature_name origin/new_feature_name

    So to declare a remote branch, even one which doesn’t yet exist on the local repository, git push is mandatory.

    git checkout --orphan new-empty-branch


    git rm -rf .

    to remove all files from new branch.

    Git Baby is a git and github fan, let's start git clone.