Skip to main content

Learn: git - 'the stupid content tracker'

Linus Torvalds named git in man page as "the stupid content tracker".

"Git was created by Linus Torvalds, the creator of the Linux kernel, in 2005. Torvalds was dissatisfied with the existing version control systems available at the time, and he wanted a system that could handle the scale and distributed nature of Linux development. Git is a distributed version control system, which means that each user has a complete copy of the repository. This makes it very efficient for collaborating on projects, as users can work on their own copies and then easily merge their changes back into the main repository." — bard.google.com

$ man giteveryday

Init git repository

git init

Add all files and folders of current path to repository

git add .

Commit to repository

git commit -m 'First commit'

What happened?

git log
git log --oneline

List all branches

git branch -a

Create and checkout a new branch with one command

git checkout -b branch_name

Clone repository

git clone

Pull repository

git pull

Reset all local changes permanently

git reset --hard

Accidently delete files

Run git checkout -- to list deleted files

PS F:\Projects\github\cloudconeapi> git checkout --
D       .gitignore
D       LICENSE
Your branch is up to date with 'origin/master'.
PS F:\Projects\github\cloudconeapi>

Git Cheat Sheet

git --version
git --help
git config --global user.name
git config --global user.email
git config --list
git clone
git pull
git pull -a : pull all branches
git add
git commit
git push
git clean
git remote add <url>
git remote rm <reponame>
git remote -v
git ls-files --deleted
git checkout -- <file>
git checkout branch-name-here
git branch --delete branch-name-here
git rm --cached .env
git rm -r --cached vendor

git clean untracked files

PS F:\Projects\github\lthwnodejs> git clean -i -d                                                
Would remove the following item:
  node_modules/
*** Commands ***
    1: clean                2: filter by pattern    3: select by numbers
    4: ask each             5: quit                 6: help
What now> c
Removing node_modules/
PS F:\Projects\github\lthwnodejs>   

.gitignore file must use UTF-8 encoding

I once have no idea why one of my .gitignore files was encoded as UTF-16 LE. So all untracked files keep showing and cannot use 'git add .' to add all new/modified files. Search google to find solution and then change encoding to UTF-8 solved my issue.

Learn Version Control with Git

This is a step-by-step course for the complete beginner.

https://www.git-tower.com/learn/git/ebook/en/command-line/introduction

Learn Git on Codecademy

https://www.codecademy.com/learn/learn-git

SAP Cloud Platform Version Control with Git by Arnaldo Cavazos on open.SAP.com

https://open.sap.com/courses/git1

Read giteveryday man page

giteveryday - A useful minimum set of commands for Everyday Git

Version Control with Git on Coursera

https://www.coursera.org/learn/version-control-with-git

What esle to learn about git?

By the way, what does git means in English?

What git means in English

Popular posts from this blog

Qubes OS: Fedora 30

Create a new Standalone VM based on fedora-29 VM template Extend root partition: run command on dom0 tuyen@dom0:~ $ qvm-volume extend fedora-30:root 12288MB Set qrexec_timeout to 600 seconds tuyen@dom0:~ $ qvm-pref --set fedora-30 qrexec_timeout 600 $ sudo dnf upgrade --refresh $ sudo dnf install dnf-plugin-sytem-upgrade $ sudo dnf system-upgrade download --release=30 Install fedora-30 template Run the following command on dom0 terminal $ sudo qubes-dom0-update qubes-template-fedora-30 Install Adobe Flash Player Adobe Flash Player will not go away soon. So, let's grab the latest version of Adobe Flash Player , then install using yum or dnf command. Verify if Adobe Flash Player is installed and works by visiting https://helpx.adobe.com/flash-player.html [user@fedora-30 ~]$ sudo dnf install Downloads/flash-player-npapi-32.0.0.238-release.x86_64.rpm Last metadata expiration check: 0:37:03 ago on Fri Aug 30 09:18:10 2019. Dependencies resolved. =========...

How to charge your device from USB Port

First of all, check BIOS Settings of your laptop or desktop Dell Look for USB PowerShare BIOS Settings: USB PowerShare Lenovo Look for Always On USB Charge in Off Mode BIOS Settings: Enable Always On USB Charge in Off Mode

Python: Free Online Courses

Ever thinking about which programming language to learn first? You can learn Python for free with these online courses.