0

I've read a bunch of tutorials and they all stop just short of what I want to do next. I've set up git on OS X and pushed all the files up to github. My git status says:

On branch master
nothing to commit, working directory clean

Now I want to update one of the files on github. Do I just update and commit on git locally and then push it up to github or do I have to pull it first? I'm the only person working on this repo. I'm sure there must there must be some documentation somewhere. Everything I've seen is for branching, merging, etc.

Answer

The accepted answer by floor below appears to be what you would do with new files. I've found that the last two steps are all I need to update an existing file:

git commit -m "Reason for change"
git push origin master

I would guess that, if the destination file on github was out of sync with your local copy, you would get an error and would have to do a merge. As stated above, this process assumes you have pushed your repository up to github for the first time and now want to make changes.

Community
  • 1
  • 1
curt
  • 4,422
  • 3
  • 42
  • 61
  • 1
    Really, there is tons of documentation / tutorials around to help you with this. Here's one: http://git-scm.com/book/en/v2/Git-Basics-Working-with-Remotes – liamness Mar 18 '15 at 00:55
  • While the linked page is useful, it doesn't explain a workflow. It tells you what you can do, but not in what order or what is required and what is optional. – curt Mar 18 '15 at 17:37

1 Answers1

2

You should pull first if your repo isn't up to date locally but since you are he only one working on it, it is highly unlikely your repo won't be up to date.You need to tell git what files to upload and which files to ignore and have a commit message.

git add -A   <-- Adds all files
git commit -m "Message"
git push origin master <--- assuming you have that setup'

You can create a file call gitignore and it holds a list of files to ignore when pushing to git. Also there is a git hub app that runs with command line and makes a gui for it. It works well. github app for mac

floor
  • 1,519
  • 11
  • 24
  • I wouldn't think you would have to add files to git every time you need to make an update. So on a repetitive basis, would it only be the last two steps? – curt Mar 18 '15 at 17:41
  • if you use the app for github is kinda does that for you. But as for git in general I don't think has that feature. Look at this link they kinda talk about it. http://stackoverflow.com/questions/16128018/git-commit-and-automatically-add-all-untracked-files – floor Mar 18 '15 at 19:58