1

So I've done an initial commit on my files from my PC to GitHub with git checkout -b [branch] and git add . and git commit and all that. I've now made a change to that file, how can I update that file on GitHub and add a commit message?

I tried git add on the file but it's already added, and git status says nothing to commit.

Can someone help with this? Thanks :)

NateDev
  • 141
  • 5
  • 14
  • possible duplicated with https://stackoverflow.com/questions/927358/how-to-undo-the-last-commits-in-git/6866485#6866485 – Gagantous Aug 30 '17 at 02:17
  • git push origin [your branch] – Ganesh Cauda Aug 30 '17 at 02:17
  • Can you show us the results of the following commands: `git branch -vva` and `git status` and `git remote -vv` –  Aug 30 '17 at 02:17
  • `git branch -vva` master 0cfb096 Initial commit * oreo-8.0.0 0cfb096 [oblivion/oreo-8.0.0] Initial commit remotes/oblivion/oreo-8.0.0 0cfb096 Initial commit `git status` On branch oreo-8.0.0 Your branch is up-to-date with 'oblivion/oreo-8.0.0'. nothing to commit, working directory clean `git remote -vv` oblivion https://github.com/OblivionMOD/android_packages_apps_Settings.git (fetch) oblivion https://github.com/OblivionMOD/android_packages_apps_Settings.git (push) – NateDev Aug 30 '17 at 02:19

2 Answers2

1

Solved! I was editing the file in Android Studio, but when I saved the file it was not being picked up by Git or nano for some reason. I edited it in nano and ran git add ., git commit and git push.

Now I just need to know why Android Studio isn't actually saving the files properly...

Thanks for the help!

NateDev
  • 141
  • 5
  • 14
0

You need to push your branch to the remote repository on GitHub with:

$ git push origin [your-branch-name]

If the branch does not have a remote repository yet (where remote is the GitHub repo), you will have to add it to your project with:

$ git remote add origin [the-url-you-obtain-from-your-github-repo]

Brandon Mowat
  • 374
  • 1
  • 8