User Tools

Site Tools


version_control

Version Control

  1. Practise the following git excercise

http://try.github.io/levels/1/challenges/1

 Please do this as team wise.
  1. Do the following
  2. Install git in your local machine as root user( use apt-get install )
  3. Set your identity(Root required)
    1. git config –global user.name “yourname”
    2. git config –global user.email youremailid
  4. Go to normal user(ctrl+d) or exit from root user
  5. Create a git folder in your local machine
    1. mkdir git
    2. cd git
  6. Clone the repository to your local machine
    1. git clone git@192.168.1.1:/home/git/camp/team$ team$ ($ represents team no.)
  7. Change the directory to team$
    1. cd team$
  8. Create a folder with your name in team$ folder
  9. Add the folder that you created to git
    1. git add <folder-name>
  10. Change the directory to your name-folder that you created
    1. cd your-name
  11. Create files that you wish to do and add it to git
    1. git add <file-name>
  12. Check the status of the Git repo
    1. git status
  13. Commit the changes that you made
    1. git commit -m “message-you-wish-to-give”
  14. Check the status
    1. git status
  15. To check the log
    1. git log
  16. Repeat the above process for each time you create/change the file
  17. Once you are done with file modifications, then push it to the main git-server
    1. git push origin master
  18. Check yourself how git diff, git show, git branch works

Happy Gitting

http://en.wikipedia.org/wiki/Revision_control

Subversion http://subversion.apache.org/

Links related to Git http://en.wikipedia.org/wiki/Git

The Git hosting software that you can install yourself http://gitorious.org/

Git reference http://gitref.org/

Git commands:

- Why Branching??

Branching makes the work more efficient as the branch you create doesnt exist 

in the remote repo and you can test out new features and bug fixes without breaking whats already working.

- To create a branch all we need to do is go to the repo(working directory) and then type following command

git branch branchname
then by using the 'git checkout' command you can switch to your branch.

-Working on branches

* git branch (lists all local branches)	
  • git branch 'branchname' (to create branch)
  • git checkout -b 'branchname' (to create a branch n switch to it)
  • git branch -d 'branchname' (to delete a branch)
  • git branch -v (to list the last commit of each branch)

- Basic Merging :

After working on a branch on a particular issue if you wanna apply those changes to the main file then what you need to do is to checkout to that file using following command
  1. git checkout 'filename'

and then you can run following command

		
		- git merge 'branchname'

and then use commit command to finalise the changes.

- Merge Commands :

  • git branch –merged (to see which branches are already merged into branch you are on)
  • git branch –no–merged (to see all branches that contain work you havent yet merged in)

-Merging Conflicts :

Whenever same part of the file is changed in two different branches and if those are

merged then GIT wont be able to merge them cleanly. Then that confilct is to be resolved and then we must execute the above commands.

version_control.txt · Last modified: 2018/03/24 11:13 (external edit)