$ git status On branch master Your branch is up-to-date with 'origin/master'. nothing to commit, working directory cleanThis is the ideal git status message. Being "up-to-date with 'origin/master'." means there is nothing to push. "working directory clean" means all the files in the current directory are being managed by git (or are being intentionally ignored via .gitignore) and the most recent version of the file has been committed.
[01]$ git status On branch master Your branch is ahead of 'origin/master' by 1 commit. (use "git push" to publish your local commits) Untracked files: (use "git add <file>..." to include in what will be committed) README.txt lab1 nothing added to commit but untracked files present (use "git add" to track)In this case, you probably want to add README.txt, but not lab1. The file lab1 is a binary file built automatically by the compiler when you run make. A general rule is if the file goes away when you run make clean, you do not want to add the file to git. Another good rule is that if you edit the file directly with your editor, the file belongs in git. So in this case, let's add, commit and push changes to the new file README.txt
[01]$ git add README.txt [01]$ git commit -m "instructions on how to run programs" [01]$ git push [01]$ git status On branch master Your branch is up-to-date with 'origin/master'. Untracked files: (use "git add <file>..." to include in what will be committed) lab1 nothing added to commit but untracked files present (use "git add" to track)This status message is OK. We are up-to-date, there is nothing to commit, but there is still an untracked file. Since this file should not belong in git, this status shows a good git repo with all updates available to the instructor and the partner.
[01]$ git status On branch master Your branch is up-to-date with 'origin/master'. Changes not staged for commit: (use "git addIn this situation, the file lab1.c was previously added to git and is maintained under version control. However, there have been some recent changes to the file you need to add and commit to git. For each of the files that are listed as modified: use git add to add these files to be part of the next commit. Once you have added all the files, use git commit -m "sample message" to save your changes to git...." to update what will be committed) (use "git checkout -- ..." to discard changes in working directory) modified: lab1.c modified: README.txt no changes added to commit (use "git add" and/or "git commit -a")
[01]$ git add README.txt lab1.c [01]$ git commit -m "Documented results" [master c0ab9a9] Documented results 2 files changed, 2 insertions(+), 2 deletions(-) [01]$ git status On branch master Your branch is ahead of 'origin/master' by 2 commits. (use "git push" to publish your local commits) nothing to commit, working directory cleanNote that the message at the end of git status now says "nothing to commit, working directory clean", but the second line reads "Your branch is ahead of 'origin/master' by 2 commits.". Fix this with git push
[01]$ git status On branch master Your branch is up-to-date with 'origin/master'. Changes to be committed: (use "git reset HEADFix this by running git commit with a short message saying what you changed in the files...." to unstage) modified: lab1.c
[01]$ git commit -m "fixed bug in read_input(...)"
[01]$ git status On branch master Your branch is ahead of 'origin/master' by 1 commit. (use "git push" to publish your local commits) nothing to commit, working directory clean flour[01]$ git push Counting objects: 5, done. Delta compression using up to 6 threads. Compressing objects: 100% (3/3), done. Writing objects: 100% (3/3), 303 bytes | 0 bytes/s, done. Total 3 (delta 2), reused 0 (delta 0) To /home/adas/share/cs31_f14/labs/01 c0ab9a9..5809244 master -> master flour[01]$ git status On branch master Your branch is up-to-date with 'origin/master'. nothing to commit, working directory clean
Note in the sample input below, git is giving some terrible advice. It is suggesting you run git add on the conflicted file and run git commit. You will need to run these steps eventually, but only after resolving the conflict. You will likely need to manually edit the conflicted files before adding and committing the fixes. Good planning and good communication with your partner can reduce merge conflicts, but it is good to know how to manage them when they do happen.
You have unmerged paths. (fix conflicts and run "git commit") Unmerged paths: (use "git add ..." to mark resolution) both modified: test1.c
$ git status fatal: Not a git repository (or any parent up to mount point /usr) Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set)If you get this error, you are not in a directory that has a git repository. Use cd or refer to the Git setup docs regarding setting up your initial repo.