How do I update Github repository after changing files locally in Git?

Asked

Viewed 9,108 times

5

After I created a repository on Github and uploaded some files to that repository, I had to make some changes to the file, made the commits, but I don’t know how to send these changes to Github.

How do I do it?

  • This one even I’m super covered with Git I know answer. Just make a git push origin <branch>, being <branch> the target branch (duh). Depending on configuration, origin may be another name you have defined.

1 answer

10


It seems to me that your problem is quite simple, you just need to know the right command to send which is the push:

git push

It has numerous variations but it alone solves the basics. Of course the commit needs to be correct to function properly and your local repository also needs to be properly configured to work with Github.

Documentation of Github.

If the Github connection has not yet been established you can do this (the first time):

git remote add origin [email protected]:usuario/nomerepositorio.git

Unless you have created the local repository with git clone there is only need (the first time):

git push origin master

Source: response in the OS.

See a diagram that the Oliver Steele created:

fluxo de comandos Git

  • 2

    It’s also worth saying that usually when someone creates a new Article on Github chooses the "add README.Md" option, it means that before the push, you’ll need a git pull to update the repository.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.