move up to the repository on github

Asked

Viewed 3,487 times

1

I’m a beginner in programming, I’m doing a project with a person and I needed to clone a repository of it on github and make some changes, how do I send the changes to github back? ps.: preferably in a new branch

2 answers

1

If you want to add all the changed files use the command:

git add .

If you only want to add a specific file:

git add NOME_DO_ARQUIVO.EXTENSAO

To create a new branch run the following commands:

git checkout -b NOME_DA_BRANCH

Commit changes with the command:

git commit -m "MENSAGEM DO COMMIT"

Send changes to the repository with the command:

git push origin NOME_DA_BRANCH

1

Create a new branch with:

git branch <nome>

Now just commit the changes and upload to the repository:

Commit:

git add .

git add the files to perform the commit. Using point(.) is to add all the files that have been modified. You can see the files changed and added to commit with git status

git commit -m "<mensagem>"

Remote repository

You can check the remote repository name with git remote and if the path with git remote get-url <nome-repositorio-remoto>

Once this is done, just use the command to push your local changes to the remote repository (github):

git push <nome-repositorio-remoto> <nome-branch>
  • but when I do this it looks like it’s going to go up to my github. There’s some way to switch and send directly to a new branch in its repository?

  • You create a local branch on your machine and when you push it creates the branch in the remote repository that you are connected to! And don’t forget to thank those who helped you there...

  • You made a Fork from your friend’s repository?

  • I did no, I just made the clone myself

  • If you’ve committed already it will be in your local repository, then for you to upload it to your friend’s repository on github you have to run this command: git push <name-repository-remote> <name-branch>

  • ah yes, got it, obg!

Show 1 more comment

Browser other questions tagged

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