Is there a git command that returns the current project name?

前端 未结 11 1323
终归单人心
终归单人心 2021-02-01 17:31

Does git have a built-in command for showing the name of the current remote project? Right now I\'m using this:

git remote -v | head -n1 | awk \'{print $2}\' | s         


        
11条回答
  •  别那么骄傲
    2021-02-01 17:44

    I would like to point out the same answer @Mike mentioned in the comments to your question, the $GIT_DIR/description file. Some other software use this for the name of the repository, such as the post-receive-email hook script. (Which actually does sed -ne '1p' "$GIT_DIR/description") and thus simply use the first line from that file as the name of the repository.

提交回复
热议问题