How to update local repo using wizard?

I use SVN and only recently switched to GitHub.

I am trying to update some files in the GitHub repository, but I get this message:

To https://github.com/.../ ! [rejected] master -> master (non-fast-forward) error: failed to push some refs to 'https://github.com/.../' hint: Updates were rejected because the tip of your current branch is behind hint: its remote counterpart. Integrate the remote changes (eg hint: 'git pull ...') before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details. 

I tried commands like git fetch origin and git pull , but none of them make my current branch keep up.

In SVN, I just did svn update and then committed my changes.

I also tried git pull origin , but I got a weird text message and I have no idea how to interact with it: Updating the local repository with the changes from the Github Repository

+9
source share
2 answers
  1. Check the current branch with the command:

    git branch

    It will show the current branch name with an asterisk (*) next to the name.

  2. Then update the local branch using the remote branch:

    git pull origin company name (this is the name of the branch with asterisks)

  3. Now you can send your code to a remote repository if you have already committed your local changes using the command:

    git push origin company name

If you haven't committed yet, first commit , and then do ga pull and push .

+22
source

Normally for git, an editor opens when you pull. This is due to the fact that you are merging changes from the remote to the local branch.

When you pull, git determines whether to merge the local branch with the remote branch. If it is necessary for the merger, it will do it and give you the opportunity to write your own message to fix the merge. At this point, you can just close the editor, and git will complete the process.

Basically, all you have to do is close the editor , and you would have done everything.

Essentially, git does the following:

 #Download all the commits from the remote git fetch origin # Merge in the commits from the remote to your local branch # If anything needs merging, this will open a text editor git merge origin/master master 
+4
source

Source: https://habr.com/ru/post/978308/


All Articles