DevOps Tools/SCM/Git

From r00tedvw.com wiki
(Difference between revisions)
Jump to: navigation, search
Line 49: Line 49:
 
~$ git clone user@hostname:repo_directory  ---  assumes the repo directory is in the remote user's home directory.
 
~$ git clone user@hostname:repo_directory  ---  assumes the repo directory is in the remote user's home directory.
 
~$ git clone https://github.com/repository/project.git
 
~$ git clone https://github.com/repository/project.git
 +
</nowiki>
 +
==push==
 +
push changes to repo
 +
<nowiki>~$ git push origin master
 
</nowiki>
 
</nowiki>

Revision as of 16:21, 19 June 2018

Overview | Source Control Management (SCM)
Git

Contents

Install and Configure

Done on CentOS 7. Serves as an agentless server and client. You can use this package to create a local repository as well as other git functions.

~$ yum install git

Setup global parameters

~$ sudo git config --global user.name "global username"
~$ sudo git config --global user.email "email address"
~$ sudo git config --system core.editor "/bin/vim"

Initializing Local Repo

Create a local directory with nothing in it. This is called initializing the repository

~$ mkdir ~/repo
~$ git init ~/repo
Initialized empty Git repository in /home/user/repo/.git/

Set repo user & email, if you want something different from the global.

~$ git config user.name "user"
~$ git config user.email "[email protected]"

Basics

add

adds a new file to the repo.

~$ git add filename
~$ git add *    ---- adds everything in the current directory
~$ git add .     ---- adds everything in the current directory

status

shows the current status of the git repository

~$ git status

commit

Commits the changes to the repo

~$ git commit -m "comment on commit"

commit anything that is staged, but not anything that is untracked.

~$ git commit -a

delete

deletes a file from the git repo. you must delete the file first.

~$ rm filename
~$ git rm filename

log

Shows you a log of all the commits and changes.

~$ git log
~$ git log --oneline       -----  shows the logs in a single line
~$ git log -p                  ----- shows details of the changes per line per log.
~$ git log --author="username"          ------- shows logs of a certain user
~$ git log --grep="search term"                 ------- shows logs of changes that match the search term
~$ git log --graph --decorate   ------ shows a directory tree view of the changes.

clone

Clones a git repository

~$ git clone "local path"
~$ git clone user@hostname:repo_directory   ---   assumes the repo directory is in the remote user's home directory.
~$ git clone https://github.com/repository/project.git

push

push changes to repo

~$ git push origin master

Personal tools
Namespaces

Variants
Actions
Navigation
Mediawiki
Confluence
DevOps Tools
Ubuntu
Ubuntu 22
Mac OSX
Oracle Linux
AWS
Windows
OpenVPN
Grafana
InfluxDB2
TrueNas
OwnCloud
Pivotal
osTicket
OTRS
phpBB
WordPress
VmWare ESXI 5.1
Crypto currencies
HTML
CSS
Python
Java Script
PHP
Raspberry Pi
Canvas LMS
Kaltura Media Server
Plex Media Server
MetaSploit
Zoneminder
ShinobiCE
Photoshop CS2
Fortinet
Uploaded
Certifications
General Info
Games
Meal Plans
NC Statutes
2020 Election
Volkswagen
Covid
NCDMV
Toolbox