GIT use homework
Goal: Everyone will pull down the files, including the pepper file I seeded
in the origin branch, into their own local git repository master branch.
Everyone will both add a file and change the pepper file in the repository by
pulling down the repository to their local system, making changes, staging,
committing and pushing the changes back up to the repository. You can use any
tool you like, but I am giving you the commands necessary to use a command interface
such as git_bash.
Assignment: Everyone will add 1 new file with their own name as the filename,
and will change the woo.txt. Add a line with your name in woo.txt. Also, add
a new file with your name as the filename. See how it merges your changes into
the repository. If you can work with a partner, you can make changes at the
same time and create and resolve into conflicts, which is great.
Here are our class repositories, and below
is the one to use for this homework. Please use your own username in place of
user_name:
ssh://username@panther.adelphi.edu/opt/git/pepper/csc440Fall15/csc440Fall15A.git
Suggested steps (tailored for pc but can be run on a mac):
- Create a folder called myprogram to hold your code. (any name is fine)
- Download git from http://git-scm.com/downloads
- Introduce yourself to the git on your machine:
- Start / program / gitbash
- Type the following:
- git config --global user.name "Joe Programmer"
- git config --global user.email jprogrammer@adelphi.edu
- Get to the folder that will hold your code
- Clone your repository:
- git clone ssh://user_name@panther.adelphi.edu/opt/git/pepper/csc440Fall15/csc440Fall15A.git
- note: use your username in place of user_name
- move into the repository
- cd *
- ls
- ls will display the files that you downloaded from the repository. It
should include the woo.txt
- Leave gitbash open and also open windows explorer
- In windows explorer (or eclipse), add one file with your name and also change
the woo.txt in some way.
- Go back to gitbash
- add all files in the folder using git add .
- commit all files in the folder using git commit -m
"your name and description of your changes"
- put the files on the repository using git push
- If someone else has made changes, you will see an error that your changes
were rejected.
- To resolve this, fetch all changes into your local git repository (but
not into your working copy), so you will not see the changes.
- Then view the differences with :
- Make the changes come into your working directory with
- It may say it had trouble merging. If it does, look at your working folder
and see that the pepper_change_this file file now has both changes and markers
for the changes. Make it look good (with a merged change and no markers)
and then readd and recommit and repush.
- git commit -a -m "merged change"
- git push
A bit more if you want
- Make one more change and commit it but do not push it.
- in class, verify other people made changes first
- try to push your change and you will definitely get the push error, so you
can fetch and merge and see the merge do a good job.
Guides:
http://git-scm.com/doc
http://git.racket-lang.org/intro.html