Showing posts with label github. Show all posts
Showing posts with label github. Show all posts

Tuesday, August 13, 2013

Git setup on Mac, Linux or Unix using Terminal


Git global setup:

git config --global user.name "Bishal Ghimire"
git config --global user.email  "you@ youremail.com"

Create Repository

mkdir yourProject
cd yourProject
git init
touch README
git add README
git commit -m 'first commit'
git remote add origin git@git.youremail.com: yourProject.git
git push -u origin master


Existing Git Repo?
cd existing_git_repo
git remote add origin git@git. youremail.com:yourProject.git
git push -u origin master


That is it ... 

Bonus Codes

Force Push Local to server

git push origin master --force


Force Pull From Server to local



# fetch from the default remote, origin
git fetch
# reset your current branch (master) to origin's master
git reset --hard origin/master



Branch and Merge




# fetch from the default remote, origin
git fetch
# create a branch at your current master
git branch old-master
# reset to origin's master
git reset --hard origin/master
# merge your old master, keeping "our" (origin/master's) content
git merge -s ours old-master

Common Git Issues And Solutions 


Issue 1 : "File Locked, unable to edit in XCode"

Solution : Change File Read Write permission 

As you have made force changes from the file from internet you are more likely to lock the files, which XCode will not allow you to edit all you can do is read the files only !
To chage that on your root folder of your terminal

sudo chmod -R 0777 ./*


Issue 2 : “fatal: remote origin already exists”


Solution :
Other 'origin' alreadt exists on remote server or is already on use

git remote rm origin
git remote add origin git@youremail.github.com:youriOSapp/my_app.git
git push -u origin --all # pushes up the repo and its refs for the first time


resync-git-repo-with-new-gitignore-file


git rm -r --cached .
git add .git commit -m ".gitignore is now working"

git-mergetool

git-mergetool - Run merge conflict resolution tools to resolve merge conflicts
Syntax - 


git mergetool [--tool=<tool>] [-y | --[no-]prompt] [<file>...]
Eg -
git mergtool --tool=emerge

Keyboard Tips 
n =  next
a / b = alter version

Read More At :

http://www.mac-terminal.com/files-and-folders/permissions/chmod/
http://stackoverflow.com/a/4787356/1294448
http://stackoverflow.com/questions/10904339/github-fatal-remote-origin-already-exists



Sunday, August 4, 2013

Discover and organize Github alternate repositories

Do you use lots of framework in your project. If so you must be using Cocoapods.
But what if you want to find alternate solution to your current framework .

Try Gitrep.

For example if you want to try RestKit as framework but explore alternate framework then
go to this link
http://gitrep.com/users/RestKit/repos/RestKit
It will show u other similar alternate framework.

But if you want to learn RestKit follow this stackover flow answer.

And for facebook's popular framework three20 - which no longer supported has alternate nimbus

http://gitrep.com/users/facebook/repos/three20

http://gitrep.com/

Happy Discovering :)