Basic git commands that we need or use everyday.
Here’s a brief explanation of each command shown here:
1. git init - With this command, you’re initializing an empty repository. That means the directory / folder where you’ve used this command becomes a git repository locally. This is used only once to create, never again for that repo.
2. git remote add origin repository-link-from GitHub - This command is run just to make a connection or introduce the local repository to the origin where the updates and omits will be pushed. This command is used just once after creating the repo.
3. git add filenames / list of files / . - basically after any change in the repository, before we commit, we have to add the changes files or stage them for commit. Usually we stage all the changes files together so we use dot(.) after git add.
4. git commit -m “custom message” - in this command, a custom message is placed so that you can track what changes you have made and when”
5. git push origin master - This is the command to push or upload all the commits or changes to GitHub repository. Instead of origin master, there can be different branches locally as well as remotely. But this is the mostly used command.