-- FernandoHaraldBarreiroMegino - 2015-01-29

Using Git

Reference: Version Control with Git (2nd Edition covers Github), John Loeliger & Matthew McCullough, O'Reilly

Configuration files
(In decreasing priority!)

.git/config: repository specific config
~/.gitconfig: user specific config
/etc/gitconfig: system config

Configuring github user

Fernandos-MBP-2:~ fbarreir$ git config --global user.name "Fernando Barreiro Megino"
Fernandos-MBP-2:~ fbarreir$ git config --global user.email "fh.barreiro@gmail.com"
Fernandos-MBP-2:~ fbarreir$ git credential-osxkeychain
usage: git credential-osxkeychain <get|store|erase>   #MEANS ITS INSTALLED!
Fernandos-MBP-2:~ fbarreir$ git config --global credential.helper osxkeychain
Fernandos-MBP-2:~ fbarreir$ git config -l
user.name=Fernando Barreiro Megino
user.email=fh.barreiro@gmail.com
core.editor=emacs
credential.helper=osxkeychain
The next time you clone an HTTPS URL that requires a password, you'll be prompted for your username and password, and to grant access to the OSX keychain. After you've done this, the username and password are stored in your keychain and you won't be required to type them in to Git again.

Setting up aliases

git config --global alias.show-graph \
'log --graph --abbrev-commit --pretty=oneline'

Query the state of an index

git status
git ls-files
git ls-files --stage

File statuses
Tracked
Untracked
Ignored: Specified in .gitignore

Inspecting the history of commits

gitk
git bisect
git blame -L 35, init/version.c

Branches
Create branches

git branch prs/pr-1138 #Create branch from HEAD
git branch prs/pr-1138 rel-2.3 #Create branch from tag rel-2.3
git branch prs/pr-1138 db7de5feebef8bcd18c5356cb47c337236b50c13 #Create branch from commit

Inspect branches

git branch
git show-branch
git show-branch bug/pr-1 bug/pr-2

Change your working directory to a branch

git checkout bug/pr-1
git checkout -b bug/pr-3 #Create a new branch and switch to it

Merges The git merge operation is context sensitive. Your current branch is always the target branch, and the other branch or branches are merged into the current branch.

git merge alternate
git log --graph --pretty=oneline --abbrev-commit

Working with remote repositories
git fetch: Retrieves objects and their related metadata from a remote repository.
git pull: Like git fetch, but also merges changes into a corresponding local branch.
git push: Transfers objects and their related metadata to a remote repository.
git ls-remote: Shows a list of references held by a given remote (on an upstream server). This command indirectly answers the question Is an update available?

Distutils

Reference: https://docs.python.org/2/distutils/index.html

MANIFEST.in files

Command Description
include pat1 pat2 ... include all files matching any of the listed patterns
exclude pat1 pat2 ... exclude all files matching any of the listed patterns
recursive-include dir pat1 pat2 ... include all files under dir matching any of the listed patterns
recursive-exclude dir pat1 pat2 ... exclude all files under dir matching any of the listed patterns
global-include pat1 pat2 ... include all files anywhere in the source tree matching & any of the listed patterns
global-exclude pat1 pat2 ... exclude all files anywhere in the source tree matching & any of the listed patterns
prune dir exclude all files under dir
graft dir include all files under dir
Edit | Attach | Watch | Print version | History: r7 | r5 < r4 < r3 < r2 | Backlinks | Raw View | Raw edit | More topic actions...
Topic revision: r3 - 2015-01-29 - FernandoHaraldBarreiroMegino
 
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    Main All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright & 2008-2021 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
or Ideas, requests, problems regarding TWiki? use Discourse or Send feedback