When I started my project, I put all my files in GitHub correctly, but with the changes I made, I forgot to update the files in git.
Now I need to pass all files to GitHub, as I’m starting in git I have no idea how to update them.
First of all, if you have Git installed, you should open Git Bash by navigating to the directory of your local repository:
Then you can optionally check the status of your repository:
To add all the files you want to commit to the stage:
git add .
Once this is done, execute the following command to commit with a message:
git commit -m "Sua mensagem"
Finally, execute the push command to send your changes
git push origin master
Git is a version control tool created by Linus Torvalds to aid in the creation of the Linux kernel. The tool has its own culture, specific language terms and concepts. A lot of research is recommended for productivity in your applications. However, it is quite common for developers to use the tool even before they have mastered all the concepts (commit, diff, pull request, status, etc.). For these cases, it is recommended a minimum script to use the tool blindly, without impairing learning. There is no pretense of this post ‘give a lesson’ of git, since comprehensive topics are not in accordance with the philosophy of this community. Here is a blind script recommendation for git starters:
1 – Clone your repository (git clone) – With the command
git clone www.seurepositorio.com you will have access to your entire project, including data files that will send new information to the original repository. Make changes to this repository (editing files, dragging folders, etc.).
2 – Suggest to add new files (git add) – The git tool assumes that your application is being built by multiple developers (for which it was created), although it is very useful for development ground. With the
git add * command you suggest adding the new files in the project. You can also choose
git add nomeDoArquivo.Ext to add a specific file.
3 – Commit (git commit) – After all the changes made, it’s time to
commitar your project. This is the act of submitting a proposal with all modifications to the project (in your case, yourself) to the PLACES administrators (on your own network or machine). Use the
git commit -m "Anote aqui as alterações como histórico" command.
4 – Submit your project (git push) – After all changes made to the local repository, it’s time to give your project a
push . This is the act of sending a proposal with all modifications to the REMOTE administrators (the original repository) of the project (in your case, yourself). Use the
git push origin" command.
Conclusion: – Git is a powerful tool, with several commands that are part of the version control routine. For the specific case of this topic, it is recommended to familiarize yourself with these four steps. Although there are other commands like
git push (updates the repository) and
git status (current situation of watched files), it is not recommended for the beginner who still works with solo developments, interrupt his projects to delve into git. The need to learn new git commands will come naturally. Although it has a large amount of texts on the internet about the tool, it will hardly find one with didactic quality. I can cite only two reasonable ones like the tableless and the guide gitpractice by Roger Dudler.
I think it’s great to learn the basic commands from at least GIT , so even if you use a git client with a graphical interface one hour will need some command, indicate some tools that are intended to facilitate the use of Git , an example is Github Desktop that is has versions for Windows and Mac
- SourceTree that supports not only Bitbucket but any Git repository and has versions for Windows and Mac
- GitKraken has versions for Windows , Mac and Linux
First you have to put your new files in the header of your local git with the following command:
git add .
Next you have to create a version describing the new changes:
git commit -m "Descreva as alterações nesse limite de aspas"
You can now send your version to your remote git with the following command:
git push origin master