Junior — Middle
What methods and strategies do you know for using version control systems like Git?
sobes.tech AI
Answer from AI
Git is a distributed version control system that allows efficient management of code changes. The main methods and strategies for using Git include:
- Basic commands:
git init,git clone,git add,git commit,git push,git pull,git merge,git branch,git checkout. - Branches: Used for parallel development of new features or fixes without affecting the main branch (usually
mainormaster). - Workflow:
- Feature branching — each new feature is developed in a separate branch.
- Git Flow — a more formalized process with branches for development, releases, and fixes.
- Forking workflow — often used in open-source, where developers create a copy of the repository and make pull requests.
- Conflict resolution: Conflicts may arise during branch merging, which need to be resolved manually.
- Rebase: Allows rewriting commit history for a cleaner and linear history.
Example of creating a new branch and committing:
git checkout -b feature/new-ui
# make changes
git add .
git commit -m "Added new UI"
git push origin feature/new-ui