Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Panel
borderColorblack
bgColor#F8F8F8
  • Show changes before commit

    Code Block
    languagebash
    themeRDark
    git diff

    .

  • View system status

    Code Block
    languagebash
    themeRDark
    git status

    .

  • Automatically record changed files

    Code Block
    languagebash
    themeRDark
    git add . -A

    .

  • Transfer all files to the repository

    Code Block
    languagebash
    themeRDark
    git commit -am "There is a comment here"

    .

  • This command shows what has happened so far

    Code Block
    languagebash
    themeRDark
    git log

    .

  • Write all recent changes to a file


    Code Block
    languagebash
    themeRDark
    git format-path -1

    .

  • Which files were changed?

    Code Block
    languagebash
    themeRDark
    git diff --stat

    .

  • Apply patch files from other participants: First only in test mode, then really:

    Code Block
    languagebash
    themeRDark
    git apply --check patchdate
    
    git apply patchdate

    .

  • Create a directory and fetch repository (e.g., via https):

    Code Block
    languagebash
    themeRDark
    mkdir gitlocal ; cd gitlocal
    
    git clone 'https://user@server.de/repository'

    .

  • Create a local branch

    Code Block
    languagebash
    themeRDark
    git branch mybranch

    .

  • Switch to a local branch

    Code Block
    languagebash
    themeRDark
    git checkout mybranch

    .

  • Show Branches

    Code Block
    languagebash
    themeRDark
    git branch

    .

  • Back to master and pick up changes

    Code Block
    languagebash
    themeRDark
    git checkout master
    
    git pull

    .

  • Apply changes to the master branch

    Code Block
    languagebash
    themeRDark
    git checkout mybranch
    
    git rebase master

    .

  • Transfer changes to the remote repository

    Code Block
    languagebash
    themeRDark
    git push origin mybranch:master

    .

  • Customize your shell prompt always to show the branch you are working on. Add Git additional information

    Code Block
    languagebash
    themeRDark
    GIT_PS1_SHOWDIRTYSTATE=1
    GIT_PS1_SHOWSTASHSTATE=1
    GIT_PS1_SHOWUNTRACKEDFILES=1
    GIT_PS1_SHOWUPSTREAM="legacy verbose git"
    export PS1='\u@\h:\w$(__git_ps1 " (%s)")\$ '

    .

  • If you get an error message saying that git_ps1 cannot be executed, add the following line to the .bashrc:

    Code Block
    languagebash
    themeRDark
    . /etc/bash_completion.d/git
Info

Original article published at http://www.karl-deutsch.at/versionsverwaltung_mit_git.html and written by Karl Deutsch.



Filter by label (Content by label)
showLabelsfalse
max5
spacesKB
showSpacefalse
sortmodified
reversetrue
typepage
cqllabel in ( "git" , "kb-how-to-article" , " git" ) and type = "page" and space = "CONKB"
labelskb-how-to-article

Page Properties
hiddentrue


Related issues


...