• Stars
    star
    168
  • Rank 224,242 (Top 5 %)
  • Language
  • License
    MIT License
  • Created over 3 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

πŸ‘¨πŸΎβ€πŸ’» The main git commands that every developer should know.

Main Git Commands

Stars Forks Issues GitHub license Follow gabrieldejesus

Main Git Commands

EnglishΒ Β Β |Β Β Β  PortuguΓͺsΒ Β Β 

  • Starting a Repository

    git init


  • Listing Modified Files

    git status


  • Undoing Changes

    • Unmonitored files

      git checkout

    • To delete new files that have not yet been added to the Stage

      git clean -df

    • Removing files from the Stage

      git reset

    • Undoing the last commit

      git revert HEAD


  • Rename Commit

    git commit β€”amend


  • Branches

    • Listing local Branches

      git branch

    • Also list the branches that are in the remote repository

      git branch -a

    • Going to another branch

      git checkout my-branch

    • If you add -b a new branch will be created

      git checkout -b my-new-branch

    • Excluding branches

      git branch -d branch-name // normal

      git branch -D branch-name // forcing

    • Renaming branches

      git branch -m new-branch-name

    • If you are on a branch and want to rename another one, you must first pass the current name of the branch you want to rename:

      git branch -m current-name new-name

    • Orphan Branch An orphaned branch has this name because it is not linked to the main branch, so their histories are not shared.

      Example:
           i --- j --- k <== branch 'my branch'
                 /
         a --- b --- c --- d --- h --- l <== branch 'main'
             \ /
               and --- f --- g <== branch 'my other branch'
    
         1 --- 2 --- 3 --- 4 <== `orphaned 'branch

    This can be useful when you want to place more than one project in the same repository. A good example is when you have a project on Github and want to create a website to publicize your project. The application and the website are different things, therefore, their codes must be versioned separately. Having both in the same repository simplifies management.

    To create an orphaned branch just use the command:

    git checkout --orphan my-branch-orphan


  • Viewing Commit History

    git log

    • History of one or more files

      git log -p my-files

    • Author's history

      git log --author = name-author

    • History by date

      git log --after = "MMM DD YYYY"

      git log --before = "MMM DD YYYY"

    • History Based on a message (commit)

      git log --grep products

      With this command we will have the history of commits in which the commit message has the word β€œproducts”. What we go through can be a regular expression, and we can spend more than one:

    Examples:

    Search for "products" OR "users"

    git log --grep products --grep users

    Search for "products" AND "users"

    git log --grep products --and --grep users


  • Display branches in a more readable mode

    It is possible to have the history printed showing the branches of the repository with something more readable and in color with a command. We will have a result similar to this:

      * a102055 (HEAD -> master) commit 8
      | * 196d28e (branch-2) commit 7
      | * 07e073c commit 3
      | * 2b077ca new fie
      | | * c1369d8 (branch-3) commit 6
      | | * d11bdcd commit 5
      | | /
      | / |
      * | 2b22b75 commit 2
      | /
      * d5a12b0 .gitignore
      * 9535426 - commit 1

    The command is a little long:

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

    To decorate everything we should write after the log.

      --all
      --decorate
      --oneline
      --graph
    

  • Working on more than one thing without committing

    There may be times when you need to stop what you are doing and start working in another task. However, it may not be good to commit something that has not yet been finalized and then return to it, resulting in a commit that will be in the history but it has code that doesn't work. We can save these changes made even without having to perform a commit to later work on it again, which is called a Stash (something like "hide" or "accumulate").

    By doing this, your repository will return to the state of the last commit, and the changes previously made will be β€œhidden”.

    • Saving changes to a Stash

      git stash

    • You can still put a name on this stash

      git stash push -m my-name-stash

    • Listing Stash

      git stash list

    • Recovering modifications

      git stash apply

    This will retrieve the most recent stash code. If you want to recover a stash oldest, just look at the number of the stash that appears when we list it and pass for the following command:

    git stash apply stash @ {2}

    • Removing Stashes

      When we retrieve changes from a stash, it remains saved. To delete it from the stack, run the drop command next to the name of the stash you want to remove

      git stash drop stash @ {5}


More Repositories

1

readme-model

πŸ’Ύ A beautiful readme model for you to put in your projects.
141
star
2

confetti

πŸŽ‰ Happy new year with this confetti effect.
CSS
67
star
3

glassmorphism

✨ Just a glass morphism effect.
JavaScript
53
star
4

http-basics

🌐 The basics of the hypertext transfer protocol (HTTP).
45
star
5

draw

🎨 A simple application for draw.
CSS
21
star
6

html-semantic

🌐 Main concepts and basic rules for semantic HTML.
19
star
7

link-generator-whatsapp

πŸ”— Link generator for Whatsapp
CSS
12
star
8

dead-covid

⚰️ Click and kill the covid.
CSS
9
star
9

buy-pizzas

πŸ• Project in which the user chooses his pizza of the desired size and quantity and automatically the chosen product and added to his cart.
JavaScript
9
star
10

carousel

🎠 A simple carousel with Next.js.
JavaScript
8
star
11

shophub

πŸ‘• A small store with some products made to exercise my new knowledge Nextjs.
TypeScript
6
star
12

day-day

πŸ“ An application to help in day to day
JavaScript
6
star
13

nanny

βš” Challenge Nanny
TypeScript
6
star
14

mario

🧱 Recreating the classic pyramid, from the super mario game in C, replacing the bricks with a #.
C
5
star
15

practice-javascript

πŸ•Ά Exercises and projects to practice the Javascript language.
5
star
16

calculator

βž• A simple calculator made in javascript.
JavaScript
5
star
17

happy

πŸ‘¦πŸ½ A web application made during the "Next Level Week" at rocketseat that aims to bring happiness to the world.
Handlebars
4
star
18

confectionery

🧁 A landing page for a pastry shop.
CSS
4
star
19

valgrind-macos

πŸ“ A simple tutorial on how to install valgrind by brew on macOS.
Ruby
4
star
20

hello.c

πŸ•Ά My first Hello in language C.
C
4
star
21

base-react

βš› Repository for notes and examples of basic concepts and fundamentals in react.
JavaScript
4
star
22

discord-bot

πŸ€– A simple bot for discord.
JavaScript
4
star
23

gabrieldejesus

πŸ‘¨πŸΎβ€πŸ¦± I create successful websites and systems on the web, fast, simple and easy to use. I just love what I do.❀️
4
star
24

list-projects

πŸ“± My first react native application.
Java
3
star
25

twitter-profile

🐀 A clone of the profile page of a common user on twitter
HTML
3
star
26

speak

πŸ”Š A simple application that reads everything that is typed inside your text area.
CSS
3
star
27

workshop-web-dev-backend-challenge

🧠 This is the last challenge for participants in the backend web development workshop.
3
star
28

forms

πŸšͺ A beautiful form for login, registration and a page forgot my password
CSS
3
star
29

semente

🌱 Sowing the habit of reading the proposal of the Seed is to encourage the habit of reading in formats different from the way we are used to. We seek to develop an app accessible to everyone, in a fun and educational way.
CSS
3
star
30

cash

πŸ’° Greedy Algorithm
C
2
star
31

svelte-typescript-starter

⚑ TypeScript starter for Svelte that includes all you need to build amazing apps.
JavaScript
2
star
32

notes

πŸ—’ An annotation application using markdown
JavaScript
2
star
33

register-with-txt

🐘 System is used to read and insert information in a txt file. It was created to exercise my new knowledge in PHP.
CSS
2
star
34

nextjs-setup

πŸ›  My settings for an application using the Next.js, TypeScript and styled-components.
TypeScript
2
star
35

planning

πŸ“‹ Organize day-to-day tasks
CSS
2
star
36

my-tasks

πŸ““ A simple Markdown as template engine.
JavaScript
2
star
37

gb

πŸ€– A bot that helps me day in and day out
CSS
2
star
38

database-upload

βš” In this challenge, I continued developing the transaction management application, training what I have learned so far in Node.js with TypeScript, but this time including using a database with TypeORM and sending files with Multer.
TypeScript
2
star
39

resize-image

πŸ“ A simple application in NodeJS to resize images to different sizes with just one command.
JavaScript
2
star
40

what-number

⌨️ A simple number check I did to test my new knowledge in the javascript language.
CSS
2
star
41

swr-auth

πŸ”’ A simple authentication to test the SWR.
TypeScript
2
star
42

webpack-threejs-starter

πŸ›΄ A simple starter with webpack and Three.js
JavaScript
1
star
43

under-maintenance

πŸ›  A maintenance page for my portfolio
CSS
1
star
44

photo-editor

πŸ“Έ Just another image editor.
JavaScript
1
star
45

reactjs-concepts

βš” The purpose of this challenge was to list, add and remove repositories from an API
JavaScript
1
star
46

rest-api

πŸ‘¨πŸ½β€πŸ’» A simple rest api that creates, reads, updates and deletes a user.
JavaScript
1
star
47

mvc

🧱 Structure MVC in PHP
PHP
1
star
48

contacts

πŸ—’ A contact list with email name and options for editing and deleting.
PHP
1
star
49

appru

πŸ” Recreating a landing page
HTML
1
star
50

solidity-and-smart-contract

πŸ“š Some Solidity studies and smart contracts,
Solidity
1
star
51

netflix

πŸŽ₯ A clone of the netflix home page with api consumption, movie listings and more.
HTML
1
star
52

password-generator

πŸ”‘ Generator of random passwords based on what the user selects (uppercase letters, lowercase letters, numbers, symbols, etc.).
CSS
1
star
53

ecoleta

πŸ—‘ Your waste collection marketplace We help people find collection points efficiently.
JavaScript
1
star
54

study-today

πŸ“‹ Project that create a list of things I have to do on the day.
CSS
1
star
55

population

πŸ¦™ Determining how long it takes for a population to reach a certain size.
C
1
star
56

meal-generator

πŸ” A random revenue generator obtaining data from a public API
CSS
1
star
57

github_explorer

πŸ™ An application that searches and visualizes public repositories on GitHub
TypeScript
1
star
58

the-beach

πŸ– This project aims to build a beach using everything I'm learning with Three.js.
JavaScript
1
star
59

react-native-concepts

βš” The objective of this challenge is to put into practice all the main React Native concepts that I’m learning.
JavaScript
1
star
60

nodejs-fundamentals

βš” The objective of this challenge was to create an application to continue training what I am learning with Node.js together with TypeScript, using the concept of models, repositories and services!
JavaScript
1
star
61

business

🌎 Recreating a business landing page.
CSS
1
star
62

atitude

πŸ† The Atitude program was created to bridge the gap between doctors and patients, and helps them to have quality medical care and remotely during quarantine, avoiding physical contact and the spread of COVID-19.
CSS
1
star