Showing posts with label Git. Show all posts
Showing posts with label Git. Show all posts

Wednesday, August 5, 2015

Git - How to resolve conflicts in Git

■ Check a status of conflicts in Git.
$ git status
On branch master
Your branch and 'origin/master' have diverged,
and have 7 and 2 different commits each, respectively.
  (use "git pull" to merge the remote branch into yours)

You have unmerged paths.
  (fix conflicts and run "git commit")

Unmerged paths:
  (use "git add <file>..." to mark resolution)

 both added:      .project

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

 modified:   .gitignore
 modified:   build.gradle

■ Edit a conflict file
 ○Before (conflicted code in a file)
<<<<<<< HEAD
sample_head
=======
sample_master
>>>>>>> master

 ○After (resolved code in a file)
<<<<<<< HEAD
sample_master
>>>>>>> master

■ Commit (You can resolve this by adding the file fixed)
$ git add .project
$ git commit

■ Check if it was fixed
$ git show | head
commit 2690c5f94cc2e9aaac6b3f17439a098ed537a311
Merge: b1bfeed 1c0394e
Author: kim_joon <kim_joon sample.io="">
Date:   Thu Jul 23 15:21:36 2015 +0900

    Merge branch 'master' of https://github.com/minziappa/neo4j_sample.git

    Conflicts:
     .project

Friday, February 6, 2015

Git - The current branch is not configured for pull

Sometime you see the error like the following message.

Solve:
You tell Git the explicit branch you want to pull.
You need to add this to your .git/config
--------------------------------------------------
[branch "master"]
  remote = origin
  merge = refs/heads/master

-------------------------------------------------

Tuesday, November 18, 2014

Git - How to change an author committed to your repository.


@ This command can change your author.
$ git commit --amend --author="New Author Name <email@address.com>"

Wednesday, May 7, 2014

Git - Using rebase

@ If you want to marge some commits into one
@ 5 is that your commits count
$ git rebase -i HEAD~5

@ Change pick for squash lik this
@ Save and quit the edit.(:qw)











@ You can edit the messeage.
@ Just save and quit the edit(:qw).

@ Push it your repository.
$ git push origin +master

---------------------------------------------------------
@ You can cancel like this
$ git rebase --abort

Friday, March 7, 2014

Git - Install Gitolite on the CentOs

$ ./install -to /usr/local/gitolite/bin
Can't locate Time/HiRes.pm in @INC (@INC contains: /home/git/gitolite/src/lib /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /home/git/gitolite/src/lib/Gitolite/Common.pm line 74.
BEGIN failed--compilation aborted at /home/git/gitolite/src/lib/Gitolite/Common.pm line 74.
Compilation failed in require at ./install line 15.
BEGIN failed--compilation aborted at ./install line 15.
-----------------------------------------------------------------------------
@You should install the following Perl module. 
$ yum install perl-Time-HiRes

Monday, March 3, 2014

Link - Make a server for git

@How to install git for server.
http://opentutorials.org/course/303/2291

Thursday, February 6, 2014

Git - Switched and Make a new branch at a time.

@ How to revert to a commit point on a branch.

@ Option -b is to make branch
@ dev-bug is a branch name
@ dc41eaf is SHA code
@ Like the following command
$ git checkout -b dev-bug dc41eaf

@Switched and make a new branch at a time.
$ git checkout -b newBranchName

@Make a new branch
$ git branch newBranchName

@Switched to a new branch
$ git checkout newBranchName

Tuesday, January 14, 2014

Git - How to fork your own repository in Github

@You should fork from the your original project in advance.

@Make a clone of your project on your machine.
$ git clone https://github.com/YOURNAME/forkedrepo.git

@Add an upstream remote to your original repository.
$ git remote add upstream git@aaa.cccc.local:ORIGINALNAME/original.git

@Pull down a copy of the original repository to your new repository.
$ git fetch upstream






 


















$ git merge upstream/master



















Or, an easier way:
$ git pull upstream master

@Upload the fresh copy of your new repository back up to git
$ git push origin master 


Wednesday, July 17, 2013

Git - Push to remote And Delete a branch

# Push origin branch, not upstream
$ git push orign service_branch

@ Delete a local branch, on the master branch.
$ git branch -d branch_name

@ If you get a error like this, but if you change the branch to master, and then
@ commend git branch -d branch_name on the prompt.
@---------------------------------------------------
@error: The branch 'branch_name' is not fully merged.
@If you are sure you want to delete it, run 'git branch -D branch_name'.
@---------------------------------------------------
$ git branch -D dev

@ Delete a remote branch
$ git push origin --delete dev

@ Make a branch in Local
$ git checkout -b branch_name

@ Make a branch in Remote
$ git push origin branch_name

@ You can not delete branches showing list
git branch --no-merged


Monday, July 8, 2013

Git - Let's Fork the project

$ #Fork the "project-name" repository
$ git clone git@github.com:njoon/project-name.git
$ cd project-name/
$ git remote add upstream git@github.com:organizations/project-name.git
$ git fetch upstream

@If you want to remove the upstream
$ git remote remove upstream
----------------------------------------------------------------------------------------------

# If you want to merge from original branch(not forked master)
$ git fetch upstream

# To merge its changes into our local branch.
$ git branch -va
$ git checkout master
$ git merge upstream/master
# And you'd better use the Pull Request.


https://help.github.com/articles/syncing-a-fork


Thursday, May 23, 2013

Git - Add a tag in order

1.Edit pom.xml
 -Like 1.0-SNAPSHOT to 1.1 2.Index

2.Add Index
 $ git add *

3.Commit
 $ git commit -m "Tag v1.1"

4.Add a tag
 $ git tag v1.1

5.push to remote server
  @ When I did the following command for Github,
       the system didn't ask me to input Id and Password
       (master = tag version)

 $ git push origin v1.1

6.return to the development
 $ git fetch origin
 $ git reset --hard origin/master

Monday, May 13, 2013

About git information

@Add remote git server URL
git fetch origin
git reset --hard origin/master
 
@Download new version from remote(you need to command the fetch)
git checkout HEAD

@Delete tags in remote.
git push origin :tags/{tag name}

@Upload remote
git push origin v1.5
git push origin --tags

@Delete tags in local
git tag -d {tag name}

@Create a tag
git tag v1.0
@Up load a tag to remote
git push --tags

@Show the commit id
git rev-parse [Tag Name]

@Delete Tag
git tag -d [Tag Name]

@Order a commit
git add *
git commit -m "This is the first commit"
git push

@DownLoad all branch from remote
git fetch origin

@
1.$ vim ./.git/config
2.[branch "master"]
        remote = origin
        merge = refs/heads/master
@a good thing to put this bellow into the config file
[alias]
        hist = log --pretty=format:'%h %ad | %s%d [%an]' --graph --date=short
[color]
        ui = true