How to use git commands?
I
will leave some quick tips to use git, I will not leave something
professional, but something that can help in your day to day with
github.
First guide - How to send my source to github?
First you must create a repository for your source in github.
Example:
my_source_repo
That done, you should now go to your command terminal:
git remote add github https://github.com/YourUser/my_source_repo
git add .
git commit -m "Your commit title"
Choose your branch (my example - master):
git checkout -b master
Now push for your github:
git push --all github
You will be prompted for your username and password, just type them and you are done.
Second guide - How do I update my repository?
Follow the commands below:
git add .
git commit -m "Your change commit"
git push origin master
Third guide - How to make cherry-pick?
If you
are wanting to make a cherry-pick of some modification made by another
user, you should follow the steps below, but be sure to verify that this
change is compatible with your source.
Commands:
git remote add master https://github.com/OtherUser/repo_to_fetch
git fetch master
git cherry-pick LogCommitChanges
For revert commit
git revert LogCommitChanges
ctrl + x
git add .
git commit -s
ctrl + x
git push origin master
Fourth tab - How to modify a commit title?
Let's suppose you missed the title to be placed at the time of the commit, follow the command below:
git commit --amend
ctrl + x
git commit --amend -m "New Title"
Enjoy the guide !