User Tools

Site Tools


git

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
git [2014/01/23 16:11] – created admingit [2021/01/19 23:58] (current) – [Git Changelog] admin
Line 1: Line 1:
 ====== Git Commandline ====== ====== Git Commandline ======
 +
 +
 +:!: Befehle kommen von hier: http://git-scm.com/book/en/Getting-Started-First-Time-Git-Setup :!:
  
 ===== Befehle (lokal, kein Internet benötigt ) ===== ===== Befehle (lokal, kein Internet benötigt ) =====
Line 15: Line 18:
  
   git commit -m 'Mahlzeit ref #12'   git commit -m 'Mahlzeit ref #12'
 +
 +==== Zeige Branches ====
 +
 +  git branch
 +
 +==== GIT Einstellungen ====
 +
 +Benutzer und E-Mail setzen.
 +
 +  git config --global user.name "John Doe"
 +  git config --global user.email johndoe@example.com
 +
 +
 +===== Befehle die Internet benötigen =====
 +
 +==== Master-Branch hoch schieben ====
 +
 +Schiebt die lokale Repoauf die online Repository (origin) in den Branch (master)
 +
 +  git push origin master
 +  
 +==== Repository downloaden (Clone) ====
 +
 +  git clone http://redmine.knallimall.org/git/linuxmce-jsorbiter/
 +
 +
 +====== Git Submodules (sub repository) ======
 +
 +===== Create a Submodule =====
 +
 +To link one repository into another in git you can use a thing called submodules:
 +
 +  git submodule add http://YOUR.PATH/TO/GIT/REPO FOLDER_NAME
 +
 +Example:
 +
 +  cd /YOUR/CLONED/REPO
 +  git submodule add https://redmine.knallimall.org/git/imagemap/ dokuwiki_imagemap
 +  git add .
 +  git commit -m "Add submodules ..."
 +  git push origin master
 +
 +===== Clone a Repo containing submodules/ =====
 +
 +Submodules need to be initialized and downloaded
 +
 +  cd /YOUR/CLONED/REPO
 +  git submodule init
 +  git submodule update
 +
 +
 +===== Update a submodules repo =====
 +
 +When updating a submodule its required to tell the parent repository to use the latest downloaded version.
 +
 +  cd /YOUR/CLONED/REPO/SUBMODULE/
 +  git pull origin master
 +  cd /YOUR/CLONED/REPO
 +  git commit -am "Upgrade submodules ..."
 +  git push origin
 +
 +===== Pull =====
 +
 +  git pull origin
 +  git submodule update
 +
 +====== Change git Author ======
 +
 +<code bash git.sh>
 +#!/bin/sh
 +
 +git filter-branch -f --env-filter '
 +
 +OLD_EMAIL="OLD@E_MAIL"
 +CORRECT_NAME="ochorocho"
 +CORRECT_EMAIL="rothjochen@gmail.com"
 +
 +if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
 +then
 +    export GIT_COMMITTER_NAME="$CORRECT_NAME"
 +    export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL"
 +fi
 +if [ "$GIT_AUTHOR_EMAIL" = "$OLD_EMAIL" ]
 +then
 +    export GIT_AUTHOR_NAME="$CORRECT_NAME"
 +    export GIT_AUTHOR_EMAIL="$CORRECT_EMAIL"
 +fi
 +' --tag-name-filter cat -- --branches --tags
 +</code>
 +
 +====== Git Changelog ======
 +
 +Generate a simple changelog of all commits between latest 2 tags.
 +
 +<code bash>
 +#!/usr/bin/env sh
 +
 +TAGS=($(git tag --sort=-version:refname | head -n 2))
 +git log --pretty=format:"* %s" "${TAGS[0]}"..."${TAGS[1]}" > RELEASE_CHANGELOG.md
 +</code>
  
  
git.1390489887.txt.gz · Last modified: 2014/01/23 16:11 by admin