Aller au contenu principal

How GIT Works ?

How GIT Works ?
home10 figure1 1

How GIT Works ?

Git’s popularity is undeniable, as it has become an essential tool for version control and collaboration, making it nearly impossible to ignore its significance in modern coding workflows.

Happy to share this illustration, and you should probably understand these basic commands to get started:

Git clone

Clone a remote repository to create a local copy.

  • git clone https://github.com/utilisateur/nom-du-depot.git

Git checkout

Switch branches or commits in your local repository.

  • git checkout my-branch

Git fetch

To fetch updates from the remote repository to the local repository:

  •  git fetch
Git pull

Fetch and merge changes from the remote repository into the current branch.

  • git pull

git reset –hard remote/branch

To reset the current branch to match a specific remote branch:

  • git reset –hard origin/my-branch

git merge

To merge changes from one branch into another:

  • git merge my-other-branch

git rebase

To reapply your local changes on top of another branch:

  • git rebase target-branch

git stash

To temporarily save changes that are not ready to be committed:

  • git stash

git add

To stage changes from the working directory to the staging area:

  • git add modified-file

git commit -a

To commit all changes, including those in the working directory and the staging area:

  • git commit -a -m “Commit message”

git commit

To commit staged changes to the local repository:

  • git commit -m “Commit message”

git stash apply

To apply changes from the stash to the working directory:

  • git stash apply

git push

To push local commits to the remote repository:

  • git push origin my-branch

git rm

To remove files from both the working directory and the staging area:

  • git rm file-to-remove

À lire aussi

Laisser un commentaire

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *