Junior
What commands do you use in Git?
sobes.tech AI
Answer from AI
Main Git commands I regularly use:
git clone <url>— cloning a remote repository.git status— viewing the current state of the repository.git add <file>— adding changes to the staging area for commit.git commit -m "message"— creating a commit with a description of changes.git push— pushing local commits to a remote repository.git pull— fetching and merging changes from a remote repository.git branch— viewing and creating branches.git checkout <branch>— switching between branches.git merge <branch>— merging a branch into the current one.
Example workflow:
git clone https://github.com/user/project.git
cd project
# Create a new branch for a feature
git checkout -b feature-branch
# Make changes
git add .
git commit -m "Added a new feature"
git push origin feature-branch
These commands help work efficiently with code versions and organize collaborative work in a team.