Skip to content

Instantly share code, notes, and snippets.

View vanpeerdevelopment's full-sized avatar

Dieter Van Peer vanpeerdevelopment

View GitHub Profile
@vanpeerdevelopment
vanpeerdevelopment / remote-add-list.sh
Created January 28, 2014 20:58
Adding en listing remotes.
# Add a remote
git remote add [name] [location]
# Show details of remote
git remote show [name]
# Show a list of the known remotes
git remote
# Show the details of all known remotes
git remote -v
@vanpeerdevelopment
vanpeerdevelopment / remote-push-pull.sh
Created January 28, 2014 20:53
Git push an pull use origin as default remote.
# git push [target]
# The following are equivalent
git push
git push origin
# git pull [source]
# The following are equivalent
git pull
git pull origin
@vanpeerdevelopment
vanpeerdevelopment / after-gitignore.sh
Created January 28, 2014 20:13
Remove already committed files after adding gitignore.
# Remove already committed file
git rm -r --cached [filename]
@vanpeerdevelopment
vanpeerdevelopment / gitignore-maven-eclipse.sh
Created January 28, 2014 20:09
Typical gitignore file for a maven eclipse project.
# Ignore .settings folder of Eclipse
.settings/
# Ignore .project file of Eclipse
.project
# Ignore Mavens target folder
target/
@vanpeerdevelopment
vanpeerdevelopment / git-push-default-simple.sh
Created January 28, 2014 19:52
Configure Git to use the simple strategy as push default.
# Use the simple strategy as push default
git config push.default simple
@vanpeerdevelopment
vanpeerdevelopment / git-push-default-warning.sh
Last active January 4, 2016 20:29
Warning when pushing to a remote for the first time.
git push
# warning: push.default is unset; its implicit value is changing in
# Git 2.0 from 'matching' to 'simple'. To squelch this message
# and maintain the current behavior after the default changes, use:
#
# git config --global push.default matching
#
# To squelch this message and adopt the new behavior now, use:
#
@vanpeerdevelopment
vanpeerdevelopment / git-cache-credentials.sh
Last active January 4, 2016 20:29
Command to cache your credentials in Git.
# The default cache timeout is 15 minutes
git config credential.helper cache
# With --timeout the cache timeout is configured to one hour
git config credential.helper "cache --timeout=3600"
@vanpeerdevelopment
vanpeerdevelopment / git-user-config.sh
Created January 28, 2014 19:10
Git commands to configure the username and email address to be recorded with commits.
# Configure username
git config user.name "Your Name"
# Configure email address
git config user.email "[email protected]"
@vanpeerdevelopment
vanpeerdevelopment / remove-git-config.sh
Created January 28, 2014 18:52
Command to remove a git configuration.
# Remove repository configuration
git config --unset [key]
# Remove global configuration
git config --global --unset [key]
# Remove system configuration
git config --system --unset [key]
@vanpeerdevelopment
vanpeerdevelopment / git-config.sh
Last active January 4, 2016 20:20
Configuration git and listing the used configuration
# Add repository configuration
git config [key] [value]
# Add global configuration
git config --global [key] [value]
# Add system configuration
git config --system [key] [value]
# Show repository configuration for key
git config [key]
# Show global configuration for key