Comment GIT Fonctionne ?
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:
Clone a remote repository to create a local copy.
- git clone https://github.com/utilisateur/nom-du-depot.git
Switch branches or commits in your local repository.
- git checkout my-branch
To fetch updates from the remote repository to the local repository:
git fetch
Fetch and merge changes from the remote repository into the current branch.
- git pull
To reset the current branch to match a specific remote branch:
- git reset –hard origin/my-branch
To merge changes from one branch into another:
- git merge my-other-branch
To reapply your local changes on top of another branch:
- git rebase target-branch
To temporarily save changes that are not ready to be committed:
- git stash
To stage changes from the working directory to the staging area:
- git add modified-file
To commit all changes, including those in the working directory and the staging area:
- git commit -a -m “Commit message”
To commit staged changes to the local repository:
- git commit -m “Commit message”
To apply changes from the stash to the working directory:
- git stash apply
To push local commits to the remote repository:
- git push origin my-branch
To remove files from both the working directory and the staging area:
git rm file-to-remove