Skip to content

This Git repository was created for the purpose of storing and documenting a collection of common Git commands. Here, you'll find a variety of commands frequently used during project development with Git, from basic operations to more advanced tasks.

Notifications You must be signed in to change notification settings

IvanilsoDaSilva/git-commands

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

84 Commits
 
 
 
 

Repository files navigation

──────▄▀▄─────▄▀▄
─────▄█░░▀▀▀▀▀░░█▄
─▄▄──█░░░░░░░░░░░█──▄▄
█▄▄█─█░░▀░░┬░░▀░░█─█▄▄█

1.1. INTRODUCTION 📰

Welcome to the "git-commands" repository. Here, I aim to create a valuable resource for all beginner developers, who want to improve their skills in using Git, one of the most essential tools for version control.

1.2. DESCRIPTION 📝

This Git repository was created for the purpose of storing and documenting a collection of common Git commands. Here, you'll find a variety of commands frequently used during project development with Git, from basic operations to more advanced tasks.

1.3. TECHNOLOGIES 💻

Git  GitHub 

Markdown 

1.4. GIT COMMANDS 💡

Use the following commands (if there are commands) by CTRL+V where necessary

1.4.3 BASIC

📌 COPY A REMOTE REPOSITORY

git clone {remote repository link}

📌 SYNCHRONIZE THE LOCAL REPOSITORY TO THE REMOTE

git remote add origin {remote repository link}

📌 INITIATE GIT

git init

📌 ADD CHANGES FROM A LOCAL REPOSITORY

git add {path of the files to be added separated by space, or use "*" and also "." to add all changes}

📌 REMOVE CHANGES FROM A LOCAL REPOSITORY ✨

git reset HEAD {path of the files to be added separated by space, or use "*" and also "." to add all changes}

📌 PACK CHANGES FROM A LOCAL REPOSITORY INTO A COMMIT

git commit -m {commit description}

📌 ADD COAUTHOR ✨

git commit -m "Commit name.


Co-authored-by: {COAUTHOR NAME} <{COAUTHOR EMAIL}>

📌 UNDO THE LAST COMMIT (WITHOUT LOSING CHANGES) ✨

git reset --soft HEAD~{number of commits back}

📌 UNDO THE LAST COMMIT (LOSING CHANGES)

git reset --hard HEAD~{number of commits back}

📌 UPDATE REMOTE REPOSITORY FROM LOCAL REPOSITORY

git push origin {branch}

📌 UPDATE ALL REMOTE REPOSITORY FROM LOCAL REPOSITORY

git push --all

📌 SHOW THE COMMIT HISTORY OF A REPOSITORY

git log

📌 UPDATE LOCAL REPOSITORY FROM REMOTE REPOSITORY

git pull

📌 UNDO ALL CHANGES

git checkout .

1.4.3 BRANCHS

📌 CREATE A LOCAL BRANCH

git checkout -b {branch name}

📌 SHOW LOCAL REPOSITORY BRANCHES

git branch

📌 SHOW UNCOMMITTED CHANGES FROM A BRANCH ✨

git status

📌 SHOWS DETAILED INFORMATION ABOUT A BRANCH ✨

git show

📌 SWITCH BETWEEN LOCAL BRANCHES

git checkout {branch name}

📌 RENAME A LOCAL BRANCH ✨

git branch -m {branch name} {branch name to rename}

📌 UPDATE LOCAL REPOSITORY BRANCHS FROM REMOTE REPOSITORY ✨

git fetch --prune --all

📌 BRING THE UPDATE FROM A COMMIT TO THE CURRENT BRANCH ✨

git cherry-pick {commit hash}

📌 UPDATES THE CURRENT BRANCH FROM ANOTHER BRANCH ✨

git merge {branch name}

📌 DELETE A REMOTE BRANCH

git push origin :{branch name}

📌 DELETE A LOCAL BRANCH

git branch -d :{branch name}

📌 DELETE A LOCAL BRANCH (FORCED)

git branch -D :{branch name}

1.4.3 OTHERS

📌 SHOW GIT USER NAME ✨

git config user.name

📌 SHOW GIT USER EMAIL

git config user.email

📌 COPY A REMOTE REPOSITORY (EXACT COPY)

git clone --mirror {remote repository link}

📌 UPDATE LOCAL REPOSITORY FROM REMOTE REPOSITORY (EXACT COPY)

git push --mirror {remote repository link}

1.5. GIT WORKFLOW COMMANDS 💡

Use the following commands (if there are commands) by CTRL+V where necessary

Gitflow is an alternative Git branching model that consists of using resource branches and several primary branches. It was first published and popularized by Vincent Driessen on nvie. Compared to trunk-based development, Gitflow has more long-lived branches and larger commits. Under this model, developers create a feature branch and delay the merge with the main trunk branch until the feature is complete.

📌 INITIATE GIT WORKFLOW

git flow init

📌 STARTS A NEW BRANCH (feature, bugfix, realese, hotfix, support) ✨

git flow {branch type} start {branch name}

📌 FINALIZE A BRANCH (feature, bugfix, realese, hotfix, support)

git flow {branch type} finish -m {merge description} {branch name}

📌 PUBLISHES THE BRANCH TO THE REMOTE REPOSITORY (feature, bugfix, realese, hotfix, support)

git flow {branch type} publish {branch name}

1.6. GIT SEMANTIC 💡

Semantic Git is an approach to code version control that aims to bring more meaning and structure to the changes made in a software development project. Unlike traditional versioning, where versions are just sequential numbers, Semantic Git uses a versioning system based on meaning and semantics.

The central idea of Semantic Git is to assign a clear meaning to the changes made to the code. This is achieved through the use of semantic versioning rules, which define a standard for version numbering based on the impact of the changes.

📌 STRUCTURE

{type}({scope: optional}): {commit description}
{body: optional}
{footer: optional}

📌 EXAMPLE

FEAT(api):Impedir a corrida de solicitações

Introduza um ID de solicitação e uma referência à solicitação mais recente. Demitir
respostas recebidas que não sejam da última solicitação.

Remova os tempos limite que foram usados para mitigar o problema de corrida, mas são
obsoletos agora.

Revisado por: Z
Referências: #123

📌 FEAT
Indicates the addition of a new feature to the project. Use this prefix when the commit introduces a new capability or feature into the software.

📌 BUGFIX
As the name implies, it's a BUG and needs to be fixed immediately, as soon as possible. In another article I'll explain more about the use of this guy and the main branches.

📌 HOTFIX
Sometimes this term can be used in other ways, even in place of bugfix. However, I prefer to separate them, to leave them with different semantics. It's very similar to bugfix/, but it's not a BUG, it's a correction, whether it's to color, text, or not-so-urgent changes that don't mean BUGs.

📌 REFAC
Used when there are changes to the code that do not add new functionality or fix bugs, but improve the structure, readability or efficiency of the existing code.

📌 CHORE
This refers to tasks related to configuration adjustments, dependency updates, minor refactorings, etc. This prefix is used for commits that are not directly linked to features or bug fixes, such as adding a package to gitignore.

📌 DOC
Indicates changes to the project documentation, such as README updates, code comments, examples, guides or any other form of documentation.

📌 TEST
Used for test-related commits, such as adding or modifying unit tests, integration tests or automated tests in general.

📌 STYLE
This refers to changes in formatting, spacing, indentation or any change related to the aesthetics of the code, without affecting its operation.

📌 REVERT
Used to revert a previous commit, canceling the changes introduced by it.

📌 BUILD
Indicates changes related to the build process, compilation or packaging of the project, such as build scripts, CI/CD configurations, or updates to build dependencies.

📌 INIT
Used for the first commit of a project, marking the start of the Git repository.

1.7. OTHER REPOSITORIES 📘

More...

1.8. FONTS 📚

www.conventionalcommits.org www.betrybe.com https://www.linkedin.com

About

This Git repository was created for the purpose of storing and documenting a collection of common Git commands. Here, you'll find a variety of commands frequently used during project development with Git, from basic operations to more advanced tasks.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published