How do I get my Git commits to show on github? - github

I am new to this world and enrolled in a bootcamp. We created a GitHub account a few months ago. At the time everything worked fine. I was able to make changes locally and commit them via the command line, fork repos, clone them, make changes, and commit. All the good stuff.
Now after not using GitHub for much recently we are back working on a project there. However, now whenever I make a commmit it is not tracking on GitHub. When I make the change, add it and commit it I receive the below message and no changes show on GitHub.
1 file changed, 1 insertion(+), 1 deletion(-)
I am not sure what has happened. Is it possible I have moved the files to the wrong directory? At this point I am not sure how to tell what directory I need to have the files in. Any insights would be much appreciated.

You need to git push to send your local changes to GitHub.
https://training.github.com/downloads/github-git-cheat-sheet/

Related

GitHub Desktop doesnt pick and push the entire repository

I am using GitHub desktop application on my local machine and when I create and complete my repository(web directory)on my local machine, then I push it GitHub online through desktop application. But here is my problem:
Sometimes it doesn't pick and push all of the files/folders from my local repository, it only pick 3 files, while my repository has 5 folders and one inex.html file.
And sometimes it works perfectly fine. I never understand where is my problem. Any thoughts on this?
Do a git status before your push, as well as a git show HEAD to check the content of your last commit.
That way, you will see if there remain some files not added to the index or not committed.
And you will see if every files you wanted is in a commit.
If one file is consistently ignored, see if it is actually ignored by Git with:
git check-ignored -v -- a/file

GitHub - 2 Developers working at the same time

Some friends of mine and me are trying to code an application. We are probably going to using the Eclipse IDE and also want to use GitHub (because we heard, it is the leading platform for team-developments).
I think, I understood this whole Push, Pull and Commit thing.
Let's say my friend is pushing a new update for our project; but in the meantime I'm working on something else in the same project. What happens if I pull the updated version? Will the code, which just i wrote, be overwritten by the GitHub-project?
If yes, is there any way to prevent this in a simple way?
No , when someone pushes at a remote server in your case GitHub , only the remote branches gets updated . When you pull from the remote server the remote branches in your local computer gets updated to their new position , however you local master branch remains the same , you can merge your master branch with that of the remote master branch in order to combine your works . If same file has been edited , then there will be conflicts and you have to resolve them using some merge tool . However if no same files are edited then merging will be smooth. If you want to ignore your friend's work just rebase your commit over his

How to view file changes before pulling through GitHub on RStudio?

I'm transitioning from using Subversion in Eclipse for code management to GitHub in RStudio. It's starting to make sense, but I can't seem to figure out how to pull effectively.
Specifically, if I use the Pull arrow in RStudio, every file change in the repository automatically updates my local files without warning. I can see how many files were updated, but not what changed!
Here are the questions I'm hoping to get help with:
1) Can I preview the repository file changes in RStudio before I pull them locally? With SVN in Eclipse, there was an indicator showing files with a difference, and the option to view side by side.
2) If multiple files have been changed on the repository, is it possible to pull just 1 locally?
3) How can I revert a local file to a previous version?
Right now I've been trying to do this all within RStudio for simplicity. I haven't used things like the GitHub desktop client.
I appreciate the help!
I would suggest you better get used to the git's own tools to stay informed about your repository.
For example you could do following.
Before you pull, check your current commit logs
git log
This should show you how your current commits stack up. Note the latest commit id (first 4-5 letters would usually do)
Now after pulling you can see the difference using following command
git diff --color your_previous_commit_id..HEAD
If you don't like the changes and want to go back,
you can just reset to your favorite commit with following command. BTW run "git stash save" to keep a copy of your uncommitted changes.
git reset --hard you_favorite_commit_id
Note: that this will delete all your uncommitted changes unless you stashed them and put your local branch behind the remote repo branch you are tracking again.
Wondering where to put these commands? Check https://git-scm.com/downloads.
What's good about using these git tools is that if you switch between IDEs you don't need to search for same functionalities you had in your earlier IDEs.

GitHub client cannot sync after changes made to some files

I have a git repository in which I work in collaboration with some people but I cannot sync anymore. I am using the GitHub Windows client application on Windows 7:
Last time I synced, the operation succeeded and I ended up with a perfect copy of the latest code.
Next, I made some simple changes to a few files, but did not commit anything yet.
In the meantime, someone else made changes to some other files.
In order to see the changes of the repository, I'm trying to sync again.
GitHub client reports "Sync failed".
Now I am wondering if this is normal behavior or if there is something wrong with my repository ? Shouldn't I be able to sync the repository and get latest files even though I am making some changes that are still not committed ?
Thanks.
When you got this kind of error just try to open a git shell and type git status into your working directory. You will have some infos that could help you like which files are in conflict.
It must be one of the other collaborators that updated and pushed a file you just updated. If so, you will have to choose which version you want to keep in your local files.

How to undo the sync to get the files in local repo back?

I'm very new to github and I started using it a few weeks ago for my uni group project.
The problem that I'm having is:
There is a remote repo on github where everyone in the group is using.
I do have a local repo on my laptop, where I've worked my part of the project.
I recently committed and synced the updates that I made to github using desktop app for mac.
I got a few errors and the sync failed.
After that when I looked at the files that I have locally, they got overwritten by the ones from the git(non-updated version) and all of my work are gone.
Can you please help me on what I should do to receive the files that I had locally? Is there any way that I can undo that last sync. I found a few suggestions online, but since I'm not sure which one to use, I don't really want to mess up the files anymore.
Thanks
(Nearly) All changes made to git repositories can be undo. We don't know the commands you entered but enter it at Google for a specific solution.
You proberly have to use something like:
$git rebase