• Stars
    star
    168
  • Rank 225,507 (Top 5 %)
  • Language
  • License
    MIT License
  • Created almost 4 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

practice-javascript

๐Ÿ•ถ Exercises and projects to practice the Javascript language.
5
star
15

mario

๐Ÿงฑ Recreating the classic pyramid, from the super mario game in C, replacing the bricks with a #.
C
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

resize-image

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

svelte-typescript-starter

โšก TypeScript starter for Svelte that includes all you need to build amazing apps.
JavaScript
2
star
33

notes

๐Ÿ—’ An annotation application using markdown
JavaScript
2
star
34

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
35

nextjs-setup

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

planning

๐Ÿ“‹ Organize day-to-day tasks
CSS
2
star
37

my-tasks

๐Ÿ““ A simple Markdown as template engine.
JavaScript
2
star
38

gb

๐Ÿค– A bot that helps me day in and day out
CSS
2
star
39

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
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

mvc

๐Ÿงฑ Structure MVC in PHP
PHP
1
star
47

contacts

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

appru

๐Ÿ” Recreating a landing page
HTML
1
star
49

rest-api

๐Ÿ‘จ๐Ÿฝโ€๐Ÿ’ป A simple rest api that creates, reads, updates and deletes a user.
JavaScript
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

github_explorer

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

meal-generator

๐Ÿ” A random revenue generator obtaining data from a public API
CSS
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