Quote:
Originally Posted by suzzer99
Git is driving me bananas. Almost lost eight hours worth of work tonight due to merge conflicts. People on Macs - do you use Source Tree, command line, or something else? When you have to merge do you use some external tool, or just do it by hand? Do you have strategies to avoid conflicts? I'm going to suggest we break everything into really small files until we get this sorted out.
We have hundreds of total years of version control experience in my office. But no one knows much more than beginner level at git. We barely even have anyone working on this project yet. It's going to get completely insane when we have a bunch of developers. We're using bitbucket. Is github any different? Looking at commercial licenses for one or the other.
I know I must be doing something really wrong, because it should not be this difficult. Every time we have a conflict, it's a nightmare trying to figure it out. I have no idea what the pull-commit-resest-stage-push sequence should be. One time somehow I managed to wipe out everyone else's recent changes. And then this time almost wiped out my own. Luckily I was able to hit ctrl-Z in sublime text, and get back to the previously saved file. Definitely liking sublime so far.
Matthew McCollough and Tim Bergland do a nice course that's on Safari Books (both beginner and advanced) for using git. I generally like it but have not used other (except a little bit of subversion)
Generally I try to stick with the basics:
-git clone
copies repository into working directory
-git add .
adds all file changes
learn how to use .gitignore files
-git commit -m "put your comment here"
stage changes for pushing
-git push origin master
can also be: -git push origin some_branch
-git pull origin master
pulls master branch into your local repository and merges
-git stash
stash local changes and accept master changes. useful
when something irrelevant has changed locally
-git branch
useful when working in teams on branches. This gets to the point where I like to manually branch just by changing the names of files by adding _edit or similar and manually deleting my "branches"
Also useful for getting keys setup on multiple machines:
$ ssh-keygen -t rsa -C "youremail@somesite.com"
Enter file in which to save the key (/home/ubuntu/.ssh/id_rsa):
Passphrase (empty for no passphrase):
$ cat ~/.ssh/id_rsa.pub
After logging into your GitHub account, go to your GitHub SSH Keys settings at
https://github.com/settings/ssh/. Click on the Add SSH Key button, give it a name and paste the contents of the public key into the Key text field. Then, click the Add key button. Enter your GitHub password when prompted