How to find which git branch I am on when my disk is mounted on other server

Our git repo is on a Linux server; I can be on the master branch or create a new branch that I can go inside and use.

Our git repo disk is mounted on AIX box to build (I can see git directory in the AIX box that allows me to build)

In the AIX box how I can see that I am using master or inside a particular branch. What changes inside .git that drives which branch I am on?

  • GIT how to update branches with different files
  • Git-flow reopening a finished feature
  • Move the most recent commit(s) to a new branch with Git
  • Rename all Git branch names to lowercase on Windows (GitHub remote)
  • How to show all tagged commits not reachable by a branch?
  • GIT support for branch based user authorization - Best Practices or Tools?
  • List all local commits in the current branch that have not been pushed to remote for Git tool
  • Accidently Pulled Down Branch with the Same Name
  • 5 Solutions collect form web for “How to find which git branch I am on when my disk is mounted on other server”

    git branch with no arguments displays the current branch marked with an asterisk in front of it:

    user@host:~/gittest$ git branch
    * master
      someotherbranch
    

    In order to not have to type this all the time, I can recommend git prompt:

    http://volnitsky.com/project/git-prompt/

    In the AIX box how I can see that I am using master or inside a particular branch. What changes inside .git that drives which branch I am on?

    Git stores the HEAD in the file .git/HEAD. If you’re on the master branch, it could look like this:

    $ cat .git/HEAD
    ref: refs/heads/master
    

    Try using the command: git status

    You can look at the HEAD pointer (stored in .git/HEAD) to see the sha1 of the currently checked-out commit, or it will be of the format ref: refs/heads/foo for example if you have a local ref foo checked out.

    EDIT: If you’d like to do this from a shell, git symbolic-ref HEAD will give you the same information.

    .git/HEAD contains the path of the current ref, the working directory is using as HEAD.

    Our git repo disk is mounted on AIX box to do BUILD.

    It sounds like you mounted the drive on which the git repository is stored on another server, and you are asking how to modify that.
    If that is the case, this is a bad idea.

    The build server should have its own copy of the git repository, and it will be locally managed by git on the build server.
    The build server’s repository will be connected to the “main” git repository with a “remote”, and you can issue the command git pull to update the local repository on the build server.

    If you don’t want to go to the trouble of setting up SSH or a gitolite server or something similar, you can use a file path as the “remote” location. So you could continue to mount the Linux server’s file system on the build server, but instead of running the build out of that mounted path, clone the repository into another folder and run it from there.

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