This issue arises when the user forgets to issue git push command after git commit command. When using git, please always make sure the basic steps.
In an ideal cycle while working with git, always check the following git commands were used sequentially in the following order:
git pull
git add
git commit
git push
I personally avoid majority of the issues posted about git on stack, because I always tally my git command acitivites to the above sequence.
I created an acronym to make sure I don't forget, I am hopoing the same can be useful to the reader which is:
pacp (read it as: pack push where (p=git push, a=git add, ck=git commit, push=git push).
My way to memorise the git push, add, commit, pull is:
get pack push (meaning: git the pack and then push).
In summary remember to "git" the pack and then "push".
Resolving the issues:
I would like to add my most used recovery git commands that are:
git checkout -- path/to/file/fileName.something #undo changes in file
The above undoes the changes in a file...similar can be applied for multiple files using * for file name, similarly can be applied to multiple
directories separated by space.
git reset filename.txt
The above removes the file from stage...after this command we can
safely do git commit and git will only commit those files we are in
stage which means the file "filname.txt" won't get committed)
git pull origin your_intended_branch
Changes are merged with the latest from your_intended_branch this basically merges the change which you committed but did not push. Once all goes fine, simply do the push:
git push