Linus Torvalds, Bjorn Stroustrup and Brendan Gregg will contribute to my hobby project. What for?

See for yourself: here is the project , here is the commit history .





List of contributors from the main page of the repository:





The links on the avatars lead to the profile pages of real people.



Everything is in place. In addition to the "Verified" plate as here:








Git GPG, : . , , "-" GitHub GitLab .






, //, , :



  1. ;
  2. Ctrl+Enter;


.





, Ctrl+Enter Cmd+Enter. . ยซยป, .



. , 220 . โ€” 500 .

()

, โ€” , ( ).



, โ€” , .






UPD: , :



, .



, , .

ยฉ https://habr.com/ru/post/515550/#comment_21990276

GitHub, GitLab, GitHub. (, , ).



?



SVN Git, ( ) : " , GitHub ?"



: GitHub , , , .



. , GitHub , .



, ( ) GitHub.





, Git-, :



$ git commit

*** Please tell me who you are.

Run

  git config --global user.email "you@example.com"
  git config --global user.name "Your Name"

to set your account's default identity.
Omit --global to set the identity only in this repository.

fatal: unable to auto-detect email address (got 'user@pc.(none)')


, , , .






Git : . , , : Git , .



$ git log --oneline
61c133f |     # <--     
d825484 | ,      .
1d87db4 | ,    
e5e09ae |    !
dfa34b5 |
db4191f |       โ€”
2d3468f | ,  ,    .
5990103 |      ,
43cc6a9 |     !

$ git cat-file -p 61c133f
tree 93edb4a15b5b20f6d35fee611b70d07d581fc8f4
parent d825484462dbe091daa6108538807e37ff49a4b2
author Bjarne Stroustrup <bjarne@stroustrup.com> 1597692753 +0300
committer Bjarne Stroustrup <bjarne@stroustrup.com> 1597692753 +0300

|     โ€”


GitHub, , , . : GitHub , .



. , GitHub email , . , , , . .



GitHub email ,


...



โ€ฆ !" โ€” .



, .



. : Spoofing Git Commits. ( , ) , โ€” . .



GitHub ?





, :



  • GitHub email = lala@mail.com, GPG;
  • lala@mail.com;
  • ;

    • -> "Verified";
    • -> " Verified";
    • -> ;
    • -> ;
    • -> , , โ€” .


"Unverified", .



, ? .



, -



, ( ) / , .



.



โ€” :







, , , git commit โ€” , .



, .



, , . , - , .



, GitHub. , โ€” .



, , : GitHub, .





, - GitHub , GitHub .

- GitHub : Keep my email address private. .



:





, :



  • ;
  • .


? boomburum. GitHub, . .







GitLab, , , ?



, , , .



<> โ€” , .</> , GitLab .








, .



, GitHub: .



  1. ./poem.txt;


  2. #!/bin/bash
    
    #  ,    
    #  - /   ,   
    set -eu
    
    ##########   ############################################
    
    FILE="${1:-./poem.txt}"
    OUT_DIR="${2:-./poetry}"
    OUT_FILE_NAME="README.md"
    OUT_FILE="${OUT_DIR}/${OUT_FILE_NAME}"
    
    export GIT_DIR="${OUT_DIR}/.git"
    export GIT_WORK_TREE="$OUT_DIR"
    
    if [[ -d "$OUT_DIR" ]]; then
      echo "Directory ${OUT_DIR} exists already" >&2
      exit 1
    fi
    
    if [[ ! -s "$FILE" ]]; then
      echo "File ${FILE} doesn't exist or empty" >&2
      exit 2
    fi
    
    mkdir -p "$OUT_DIR"
    touch "$OUT_FILE"
    
    git init 
    
    # ,      
    git config --local commit.gpgsign no
    
    ##########    #######################################
    
    declare -A AUTHORS=( )
    AUTHORS["Linus Torvalds"]=torvalds@linux-foundation.org
    AUTHORS["Vitalik Buterin"]=v@buterin.com
    AUTHORS["Bjarne Stroustrup"]=bjarne@stroustrup.com
    AUTHORS["Brendan Gregg"]=brendan.d.gregg@gmail.com
    AUTHORS["Guido van Rossum"]=guido@python.org
    AUTHORS["Aleksey Boomburum"]=boomburum@gmail.com
    AUTHORS["Ivan Vasilev"]=slavniyteo@gmail.com
    
    #   ,      
    #   get-next-author-name
    declare -a AUTHOR_NAMES=( "${!AUTHORS[@]}" )
    
    ##########  #############################################################
    
    get-next-author-name() {
      local GLOBAL_AUTHOR_INDEX="$1"
      local AUTHOR_INDEX="$(($GLOBAL_AUTHOR_INDEX % "${#AUTHOR_NAMES[@]}"))"
    
      echo "${AUTHOR_NAMES["$AUTHOR_INDEX"]}"
    }
    
    commit-one-line() {
      local AUTHOR="$1"
      local LINE="$2"
      local AUTHOR_EMAIL="${AUTHORS["$AUTHOR"]}"
    
      #     
      echo "$LINE" | cat - "$OUT_FILE" > temp
      mv temp "$OUT_FILE"
    
      git add "$OUT_FILE_NAME"
    
      #  '| '  , 
      #       
      git -c user.name="$AUTHOR" \
          -c user.email="$AUTHOR_EMAIL" \
          commit -m "| $LINE"
    }
    
    ##########   #######################################################
    
    LINE_IDX=0
    while IFS= read -r LINE; do
      LINE_IDX="$((LINE_IDX + 1))"
      AUTHOR="$(get-next-author-name "$LINE_IDX")"
    
      commit-one-line "$AUTHOR" "$LINE"
    done <<<"$(tac "$FILE")" #       
    
    ################################################################################


    UPD: Script updated after comment capslocky(I use git -c user.name=$nameinstead of git config ...;

    UPD: Fixed read LINE, which broke a little when I met backslashes.



  3. We run the script and are sad that the repository log on GitHub is not very suitable for reading poems;
  4. Rejoicing at how cool it looks in tig :





All Articles