0% found this document useful (0 votes)
22 views

Git Installation and Setup: Conflict Inside A File On Different Lines

This document provides instructions for installing Git, setting up SSH keys, and commonly used Git commands. It explains how to clone a remote repository, view local repository status, add and commit changes, pull from and push to remote repositories, and resolve conflicts during pushes. It also provides links for installing Git on Windows, Linux, and Mac systems, and describes how to set the merge tool used by Git.

Uploaded by

Mujoko Jawa
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views

Git Installation and Setup: Conflict Inside A File On Different Lines

This document provides instructions for installing Git, setting up SSH keys, and commonly used Git commands. It explains how to clone a remote repository, view local repository status, add and commit changes, pull from and push to remote repositories, and resolve conflicts during pushes. It also provides links for installing Git on Windows, Linux, and Mac systems, and describes how to set the merge tool used by Git.

Uploaded by

Mujoko Jawa
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

Git Installation and Setup

Install Git on your machine


Windows: http://help.github.com/win-git-installation
Linux: http://help.github.com/linux-git-installation
Mac: http://help.github.com/mac-git-installation
Generate SSH keys for accessing Reliable Git Repository:
Windows: http://help.github.com/msysgit-key-setup/
Linux: http://help.github.com/linux-key-setup/
Mac: http://help.github.com/mac-key-setup/
Setup SSH keys to avoid re-entry:
http://help.github.com/working-with-key-passphrases/

Commonly Used Commands


Clone HRP repo into your local from server:
git clone git@192.168.1.8:HRP.git

View local repo state:


git status

Add file changes to be commited:


git add <file path>
git add . (add all file changes to index to be commited)

Commit changes to local repo:


git commit m <your comment>
git commit a m <your comment> (commit all changes that havent been added to
index)

Pull from remote repo:


git pull

Push local repo to remote:


git push

To resolve conflict during commit to remote:


Conflict inside a file on different lines.
- After committing in your local repo, then you call git push. It will reject and say
there's conflict.
- call git pull and it will auto merge your conflict.
- call git push again. It will push successfully to server.
Conflict inside a file on same lines.
- After committing in your local repo, then you call git push. It will reject and say

there's conflict.
- call git pull and it will merge the conflicting content in diff style markers.
- call git mergetool and it will open the conflicting file(s) with the default merge
tool (e.g. vimdiff) in three-way diff view.
- merge the code between the local commit and the remote code, and save.
- clean the .orig file created by the merge tool by calling: git clean -f
- run git commit
- run git push
Change merge tool used by git:
git config --global merge.tool "araxis"

Include the the directory of the merge tool in the PATH

You might also like