All Projects โ†’ germancutraro โ†’ Git-Command-Guide

germancutraro / Git-Command-Guide

Licence: MIT license
๐Ÿ“™ A git command guide

Projects that are alternatives of or similar to Git-Command-Guide

docker-dca
Docker DCA (Docker Certified Associate) exam preparation guide
Stars: โœญ 26 (-50.94%)
Mutual labels:  guide
bitcoin-development-with-go
[Work in Progress] A little book on Bitcoin Development with Go (golang)
Stars: โœญ 19 (-64.15%)
Mutual labels:  guide
beatoraja-english-guide
Detailed guide for how to get started with beatoraja or BMS in general. -- For example: What is BMS, How do I set it up, Where do I download songs, How does the community work, How does the difficulty system work
Stars: โœญ 62 (+16.98%)
Mutual labels:  guide
Understanding-Analysis-Abbott-Solutions
Unofficial solutions to Understanding Analysis by Stephen Abbott (1st Edition)
Stars: โœญ 85 (+60.38%)
Mutual labels:  guide
Mei.js
a minimal, simple and helpful library for you
Stars: โœญ 15 (-71.7%)
Mutual labels:  germancutraro
command-line-quick-reference
quick reference on command line tools and techniques for the people with limited time
Stars: โœญ 331 (+524.53%)
Mutual labels:  guide
hackathons
A collection of tips and tricks for using Twilio at hackathons
Stars: โœญ 35 (-33.96%)
Mutual labels:  guide
apns-guide
๐Ÿ”” Guide to setup APNS
Stars: โœญ 82 (+54.72%)
Mutual labels:  guide
belajar.machinelearning.id
Tempat belajar Machine Learning dari Nol
Stars: โœญ 32 (-39.62%)
Mutual labels:  guide
Shopping-Cart-MERN
๐Ÿ’ธ Simple Online Shopping Cart made with the MERN Stack
Stars: โœญ 34 (-35.85%)
Mutual labels:  germancutraro
prefect-docker-compose
A simple guide to understand Prefect and make it work with your own docker-compose configuration.
Stars: โœญ 122 (+130.19%)
Mutual labels:  guide
api-guidelines
Squareboat's best practices for writing REST API's.
Stars: โœญ 76 (+43.4%)
Mutual labels:  guide
kubernetes-basico
Demonstraรงรฃo dos componentes do Kubernetes
Stars: โœญ 26 (-50.94%)
Mutual labels:  guide
SAP-ABAP-Development
SAP ABAP development, customization and enhancement guides
Stars: โœญ 51 (-3.77%)
Mutual labels:  guide
FindMyDoc
Documentations, manuels et guides d'utilisation
Stars: โœญ 36 (-32.08%)
Mutual labels:  guide
nasa-react-redux
Guide: Build a React + Redux app
Stars: โœญ 28 (-47.17%)
Mutual labels:  guide
Scambaiting-Setup
A full setup guide for scam-baiting with Oracle's VirtualBox.
Stars: โœญ 232 (+337.74%)
Mutual labels:  guide
devon4flutter-non-bloc-arch
A guide aiming to bridge the gap between the absolute Flutter basics and clean, structured Flutter Development
Stars: โœญ 283 (+433.96%)
Mutual labels:  guide
Playbook
The Nodes iOS team Playbook ๐Ÿ“–
Stars: โœญ 18 (-66.04%)
Mutual labels:  guide
js-stack-from-scratch
๐ŸŒบ Russian translation of "JavaScript Stack from Scratch" from the React-Theming developers https://github.com/sm-react/react-theming
Stars: โœญ 394 (+643.4%)
Mutual labels:  guide

Git Command Guide



git-germancutraro


Git is a version control software designed by Linus Torvalds, thinking about the efficiency and reliability of maintaining application versions when they have a large number of code files.

Advantages:

  • โœ”๏ธ Better teamwork
  • โœ”๏ธ Control of changes in the project
  • โœ”๏ธ Audit and reliability
  • โœ”๏ธ Return to previous versions
  • โœ”๏ธ Local & Remotes Repositories
  • โ–ช๏ธโ–ช๏ธโ–ช๏ธ And much more

Download
Linux Debian: $ sudo apt-get install git
Linux Fedora: $ sudo yum install git
Mac
Windows
You can write the commands in your CMD or in the git bash terminal

About this Guide:

  • ๐Ÿ”ˆ Everything in bold means that the value is relative, it changes according to each one.
  • ๐Ÿ”ˆ Is not a finished version.

Star the Project โญ

The easiest way you can contribute is by "starring" this project on GitHub! This will help you to "bookmark" the content so you can return to it. But it will also help the people who "follow" you on GitHub to discover that you find it interesting or useful.

The more people star and share the project, the more possible contributors are able to understand the value of contributing and open sourcing their knowledge!

:octocat: I will be grateful that you follow me :octocat:

Commands ๐Ÿš€


GIT Version: ๐Ÿ•ต

git --version

Set name credential: โœ‹

git config --global user.name "germancutraro"

Set E-mail credential: โœ‰๏ธ

git config โ€”-global user.email โ€œ[email protected]โ€

Disable warning detached head:

git config --global advice.detachedHead false

See all configurations: ๐ŸŒ

git config โ€”-list

See own custom configurations: ๐ŸŒž

git config --list --global

Help Command ๐Ÿ™

git help  

Get help from a specific command ๐Ÿ‘

git help commit

Create a Repository ๐Ÿ‘Š

git init

Delete a Repository ๐Ÿ’ฅ

rm -rf .git

Add a file ๐Ÿ‘‰

git add index.html

Add multiple files ๐Ÿ––

git add index.html index.js

Add all files ๐Ÿ’ฅ

git add .

Add all the files in the current directory by their extension: ๐ŸŒ•

git add *.txt

Add all the files that are in a folder: ๐Ÿ“

git add css/

Add all the files that were modified: ใ€ฝ๏ธ

git add -u

Add all the files by their extension that are inside a folder: ๐Ÿ“‚

git add pdfs/*.pdf

See modified files ๐Ÿ”ฆ

git status

See the modified files without so much information: ๐Ÿค

git status -s

See the modified files and in which branch we are working: ๐Ÿ”†

git status -sb

Delete a file that was in the staging area โ›”๏ธ

git reset index.js

Delete a file that was in the staging area by their extension โŒ

git reset *.xml

Commit Changes ๐Ÿ“

git commit -m 'navbar created'

See all the commits that we did ๐Ÿ‘€

git log

See all the commits that we did in a pretty way ๐ŸŒฒ

git log --oneline --decorate --all --graph

Create a Aliase/Shortcut ๐Ÿ’ง

git config --global alias.lg "log --oneline --decorate --all --graph"

So now we can do: git lg for the pretty log command ๐Ÿ‘†


Review of the basic and important commands

  • $ git init -> Initialize a local Git Repository
  • $ git add <file> -> Add file to the Staging Area
  • $ git status -> Check status of files in the working branch
  • $ git commit -> Commit Changes
  • $ git push -> Push to Remote Repository

git-germancutraro

See all the changes that happened between the working file and the staging file ๐Ÿ“

git diff

See all the changes that happened between the staging area file and the commited file โญ•

git diff --staged

Recover Files ๐Ÿ’ž

git checkout .

Delete all the changes added in a file ๐Ÿ“„

git checkout -- README.md

Add files and commit in the same command: ๐ŸŒŸ

git commit -am 'README actualizado'

Edit the commit message โœ๏ธ

git commit --amend -m 'We edited the message!'

Add or Back to the last commit โ†ถ

git reset --soft HEAD^

Return to a specific commit in a weak way โ†–๏ธ

git reset --soft 39ae8e6

Return to a specific commit in a hard way โฌ…๏ธ

git reset --hard 39ae8e6

List of originated commits ๐Ÿ“‹

git reflog

Go back to a point ๐Ÿ”„

git reset --hard 43809d4

Rename Files โœ๏ธ

git mv index.js app.js

Delete Files โŒ

git rm app.js

Branches

A branch is basically a new timeline that stores commits. They are used to develop functionalities independent of each other. The master branch is the default branch when you create a repository. Create new branches during development and merge them to the main branch when you finish.

git-germancutraro

Create a branch: ๐Ÿ”ฑ

git branch myBranch

See the branches of our repository: ๐Ÿ”…

git branch

Work in a specific branch ๐ŸŒฟ

git checkout myBranch

Create and move to a branch in a single command ๐Ÿ€

git checkout -b myBranch

Merge branches:

First we go back to the master branch: โ„๏ธ

git checkout master

And now we run the next command ๐ŸŒป

git merge myBranch

Once merged we can proceed to delete the branch ๐ŸŒน

git branch -d myBranch

Tags

Create a tag ๐Ÿ’…๐Ÿผ

git tag -a v1.0.0 -m "Version 1.0.0"

Insert a tag in a specific commit ๐Ÿ”–

git tag -a v0.1.0 43809d4 -m 'Alpha Version'

See all Tags ๐ŸŽŒ

git tag

See the tag message ๐Ÿ‘โ€๐Ÿ—จ

git show v1.0.0

Delete a tag โœ–๏ธ

git tag -d v0.1.0

Stash

Creation ๐Ÿ“ฆ

git stash

Get the list ๐Ÿ’ผ

git stash list

Github



github-germancutraro


Once we create a repository, we can add it to the remote server: ๐Ÿ“ฎ

git remote add origin yourRepo.git

See the remote sources of our repository: โฌ›

git remove -v

Once we have all our commits done and we have added the remote repository we can upload our files to Github:

Push: โœˆ๏ธ

git push -u origin master

git-germancutraro

But, as you can see, the tags are not uploaded with the git push command:

git-germancutraro

Push the tags โ–ถ๏ธ

git push --tags

Ignore Files โ—๏ธ

For this, you must create a .gitignore files, and there you can write the files and foulders that you dont want to upload to the github repository like:

node_modules
package-lock.json

Pull ๐ŸŒŒ

git pull

git-germancutraro

Clone a Repository โŒ›

git clone repoUrl.git

Clone a repository in a specific folder ๐Ÿ“

git clone repoUrl.git my-folder

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].