Sunday, 27 January 2019

GIT Notes

URL : www.gitlab.com/gitforteams
Add your SSH keys.

SSH generation command.

$ ssh-keygen -t rsa -C "XYZ@gmail.com"
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/jatin/.ssh/id_rsa): /c/Users/jatin/.ssh/id_rsa-orm
Your identification has been saved in /c/Users/jatin/.ssh/id_rsa-orm.
Your public key has been saved in /c/Users/jatin/.ssh/id_rsa-orm.pub.

Navigate to your account on GitLab and Add your public SSH Key.

How to keep in sync your Git repos on GitHub, GitLab & Bitbucket easily

https://moox.io/blog/keep-in-sync-git-repos-on-github-gitlab-bitbucket/

There are four common strategies:
Centralised
Patched
Forked
Branched

Downloading a Remote Repository
$ git
$ git --version
$ git help clone (use space or up/down arrow or q for exit)
$ git help --all

Cloning your gitLab
git clone  <URL> <DirectoryName>

Git Review History with Git log
$ git log
$ git log --oneline
$ git log --oneline --graph
$ gitk  (git gui  browser tool for logs)


Configuring Git
local
global

$ git config --global user.name 'Name'
$ git config --global user.email 'Email'

Text Editor for Commit Message
$ git config --global core.editor mate -w
$ git config --global core.editor subl -w

$git config --global color.ui ture

 $ git init
(HEAD)$ git config 
(HEAD)$ git status
(HEAD)$ git add .
(HEAD)$ git status
(HEAD)$ git commit -am "ok"

Copying repository
(master=default branch) $ git remote 
(master=default branch) $ git remote -v ( fetch and push branch)
(master=default branch) $ git clone URL
(master=default branch) $ git remote show <remote name>

$  less .gitignore
$ git diff
$ git remote add <local-name> <url>
$ git remote show
$ git remote -v

Branches :



$ git branch
$ git branch --list
$ git branch -a
$ git branch -r
git fetch
gt remote -v
gt remote show <remote_name>