I use git with my friend to collaborate on a project. He created a repo in github consisting folders of each of our names, so everytime i update something, I upload it to this folder then push it to github, and so does he. So everytime there's a new commit, we have to pull from github and copy paste the edited files to our own localhost (wamp).
So what i want to ask :
How do I check if there's a new commit from git bash without checking github? Git pull will pull the latest version i know, but what if i just want to check first?
Say my git folder is located in D://git/project_name. Can I copy this folder to another location (for example USB Flash Disk) then do a git pull from this USB?
If our method isn't effective, do you have any proposal on how we should use git? We're using CodeIgniter framework, so at first I proposed to just git push the whole CodeIgniter folders, but my friend said it's dangerous (cos the whole config and database is there) and unnecessary (since the main system folder will most likely be untouched). So we're using this current method (having two folders with our names and pushing and pulling everytime there's an update.
The most basic and powerful tool to do this is the git log command. By default, with no arguments, git log lists the commits made in that repository in reverse chronological order; that is, the most recent commits show up first.
Viewing a list of the latest commits. If you want to see what's happened recently in your project, you can use git log . This command will output a list of the latest commits in chronological order, with the latest commit first.
To pull up a list of your commits and their associated hashes, you can run the git log command. To checkout a previous commit, you will use the Git checkout command followed by the commit hash you retrieved from your Git log.
Answering your first two questions in turn:
origin
refers to the GitHub repository in each case, you should just run git fetch origin
. Then the "remote-tracking branch" origin/master
will be at the version of master on GitHub and you can compare it with your master with git diff master origin/master
to see the difference between those two versions, or git log master...origin/master
to see the commits which are unique to either master
or origin/master
.With regard to whether there is a better way to do what you're doing, I'm afraid I don't understand clearly enough what you're doing or trying to achieve to comment sensibly. However, having folders in the repository named after each developer with (presumably) very similar source code in them sounds a little suspect - you would typically use branches to deal with divergent versions of the same code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With