Push

WHAT IS GIT PUSH?

  • You've done your features, added to git, committed, and think everything's correct, so it's best to push your project, explaining better, is the command you do to send all your changes to the repository remeto.
$ git push origin "remote branch name"

E.g:

$git push origin master

Note: To push, git goes to your remote environment and compared the stories of each environment, the location with the remote, so sometimes, you will not be able to push if you have different past histories, always pay attention to where you will want to send the push, and always make the git log, to know how you want.

HOW TO PUSH A BRANCH?

  • As explained, you need to have a branch to push, when we create a project, it already comes with a branch, called master, we also teach you how to create a branch locally, but we do not know how to have remote branch, all you need to do is:
$ git push -u origin "branch name"

BEST WAY TO MAKE A GIT PUSH

  • There are three steps to be considered when making a git push:

    • Commit;
    • Pull;
    • Test the project to see if the pull has changed anything;
    • Push;
    • Likely git will refuse when pushing if you stop doing something, then read the message, if you don't consive, search the internet, or documentation.

Note: It is always important test the project before pushing, because with we work with other people, the push poorly done, can cause damage to the project. if you also watch out for the message with commit, let it be explained.

WHEN TO USE FORCE PUSH ?

  • The truth that NEVER one should use force for nothing, only extreme need, for example I want to change remote history, but be aware in using this command because it is able to do wrong things.
  • Before making a force, always check your history, < git log >, before and after each git command.
  • You will need to force a push only in two situations, when you do git rebase and the git --amend, because these two command changes the local history.

 

results matching ""

    No results matching ""