Middle
Tell about your experience with Git. List the basic commands for creating a commit to a remote repository.
sobes.tech AI
Answer from AI
Working with Git usually involves creating a local repository, making changes, committing, and pushing changes to a remote repository.
Basic set of commands for creating a commit and pushing it to a remote repository:
# Initialize a local repository (if not already created)
git init
# Add files to the staging area
git add <file> # or git add . for all changes
# Create a commit with a message
git commit -m "Commit message"
# Add a remote repository (if not already added)
git remote add origin <repository_URL>
# Push the commit to the remote repository
git push origin <branch> # for example, git push origin main
Also, git status is often used to check the repository status, and git pull to fetch the latest changes from the remote repository before pushing.