Git Github 筆記

git commits 大合併

# Reset the current branch to the commit just before the last 12:
git reset --hard HEAD~12

# HEAD@{1} is where the branch was just before the previous command.
# This command sets the state of the index to be as it would just
# after a merge from that commit:
git merge --squash HEAD@{1}

# Commit those squashed changes.  The commit message will be helpfully
# prepopulated with the commit messages of all the squashed commits:
git commit

git log

git log --after="2020-05-15" --before="2020-05-25"

git log --author="yuyan"

git log --grep="ISSUE-43560"

git log --pretty=format:"%Cred%an - %ar%n %Cblue %h -%Cgreen %s %n"

#git log with diff changes
git log -p

強制覆蓋 github 版本 (需注意這步將無法還原)

git push -f origin

What happens to the forks when deleting the original repository?

It depends whether the original and the fork are public or private, according to GitHub’s documentation:

  • Deleting a private repository will delete all of its forks.
  • Deleting a public repository will not delete its forks.

More detail on this page:

Get github access token

Username for 'https://github.com': XXXXXXXXXXXX
Password for 'https://XXXXXXXXXXXX@github.com':
remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead.
remote: Please see https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/ for more information.
fatal: Authentication failed for 'https://github.com/xxxxxxxx/xxxxxx.git/'

現在在使用 git clone 如果遇到要登入帳密的問題 tool 會告知要使用token 當密碼

打開github -> Settings -> Developer settings -> Personal access token –> Generate new token -> repo 勾起來-> save

Deleting a private repository

When you delete a private repository, all of its private forks are also deleted.

Deleting a public repository

When you delete a public repository, one of the existing public forks is chosen to be the new parent repository. All other repositories are forked off of this new parent and subsequent pull requests go to this new parent.

Mermaid 語法

graph LR
    A[Hard edge] -->|Link text| B(Round edge)
    B --> C{Decision}
    C -->|One| D[Result one]
    C -->|Two| E[Result two]

logic example

sequenceDiagram
  Client ->> Server : ClientHello
  Server ->> Client : ServerHello
  par
    Server -->> Client : send Certificate
    Server -->> Client : send ServerKey exchange
    Note right of Server: TCP segment
    Server -->> Client : send Certificate
  end
  Server ->> Client : ServerHello done

  Note over Client,Server: ServerHello done
  par
  Client -->> Server : ClientKey exchange
  Client -->> Server : Chabge Cipher Spec
  Client ->> Server : Finished
  end
  Note over Client,Server: Finished

LRU

graph
  start --> A
  subgraph userpass check
    A{userpass search? }
  end
    A -- match --> B[fast accept/drop]
  subgraph black check
    A -- not found --> b{black search? }
    b -- match --> C{try_cnt over?}
  end
    C -- Yes --> E[ban and drop, is hacker?]
  subgraph authorize check
    b -- not found--> D{LDAP/RADIUS check?}
    C -- no --> D
  end
  D -- fail --> f[drop and update black list]
  D -- success --> F[accept and update userpass list]

usdg test

sequenceDiagram
  Note right of PC: usdg slave mode
  Note right of EKI-1524-CE: --> vcom port1->port2 -->
  par
  PC -->> EKI-1524-CE : ssl_connect

  PC -->> EKI-1524-CE : mbus_rtu_over_ssl
  end


  EKI-1524-CE -->> Serial_Dev: mbus rtu/acscii
  Serial_Dev -->> EKI-1524-CE: mbus response
  EKI-1524-CE -->> PC :  mbus_rtu_over_ssl

SSL

graph TD
  PC -- SSL --- E[EKI1524]
  E -- Ser_TX --> S[Serial_Dev]
  S -- Ser_RX --> E

rx_bcast

graph TD
  start --> r[rx bcast/mcast and get the interface index of the packet]
  r--> c{is rx source ip match interfaces?}
  c-- Yes --> k[keep previous info] --> K[end]
  c-- No --> w[walk ip_address with subnet] --> C{same subnet?}
  C-- True --> u[use interface & subnet] --> K[end]
  C-- False or previous info is empty --> U[use interface & ip_family] --> K[end]

Other example

sequenceDiagram

sequenceDiagram
    autonumber
    Alice->>John: Hello John, how are you?
    loop Healthcheck
        John->>John: Fight against hypochondria
    end
    Note right of John: Rational thoughts!
    John-->>Alice: Great!
    John->>Bob: How about you?
    Bob-->>John: Jolly good!

classDiagram

classDiagram
  classA --|> classB : Inheritance
  classC --* classD : Composition
  classE --o classF : Aggregation
  classG --> classH : Association
  classI -- classJ : Link(Solid)
  classK ..> classL : Dependency
  classM ..|> classN : Realization
  classO .. classP : Link(Dashed)

stateDiagram-v2

    stateDiagram-v2
        State1: The state with a note
        note right of State1
            Important information! You can write
            notes.
        end note
        State1 --> State2
        note left of State2 : This is the note to the left.

journey

journey
    title My working day
    section Go to work
      Make tea: 9: Me
      Go upstairs: 3: Me
      Do work: 1: Me, Cat
    section Go home
      Go downstairs: 5: Me
      Sit down: 5: Me

gantt

gantt
    title A Gantt Diagram
    dateFormat  YYYY-MM-DD
    section Section
    A task           :a1, 2014-01-01, 30d
    Another task     :after a1  , 20d
    section Another
    Task in sec      :2014-01-12  , 12d
    another task      : 24d

pie

pie
    title Key elements in Product X
    "Calcium" : 42.96
    "Potassium" : 50.05
    "Magnesium" : 10.01
    "Iron" :  5

  轉載請註明: YuYan's blog Git Github 筆記

  目錄