How do you add a new file to the Git remote repository?
Experience Level: Junior
Tags: Git
Answer
To add a new file, to the remote repository, you first need to add it to index (staging area). Use git add .
command for this.
Then you need to commit the change to your local repository. Use git commit -m "Change description"
command for this.
Then you need to push commits from the local repository to the remote repository. Use git push
command for this.
Related Git job interview questions
What is Staging Area (or Index) in Git?
GitSource control JuniorWhat does the Git clone command do?
GitSource control JuniorWhat is a git commit command?
GitSource control JuniorHow can you identify who changed the specific file under version control and what were the changes?
GitSource control JuniorHow can you find out what were the most recent changes in Git repository and who made them?
GitSource control Junior