Category Archives: git

how to pull your favourite github project, fix something and push it to your own repository

There will be a lot of situations where you find some useful tool in github , then you start using it, in the middle of it, you hit a roadblock and the owners of tool aren’t ready yet to fix it as soon as you want, what do you  do ?

Do It Yourself

  1. get the url of your project you want to clone and run this command  git clone git://github.com/<usernameofrepo>/<projectname>.git
  2. cd <projectname>.git
  3. the main project will keep on changing but if you want to fix something in a particular version then
  4. git checkout <version of a tag> eg: git checkout 0.2.1
  5. using vi or any edit and make all the changes you need, save the files
  6. ‘git status’ command will show all the changes you have made
  7. ‘git diff’ will show the diff
  8. git add .
  9. git commit -m ‘comment for your fix’
  10. git tag <new version by tagging> eg: git tag 0.2.2
  11. https://github.com/ and follow the instructions on first and second boxes
  12. https://help.github.com/articles/generating-ssh-keys to add ssh keys so you can connect via ssh to your github a/c
  13. open ~/.git/config and change url under “remote “origin”” to https://github.com/<username>/yourproject.git
  14. add the following section to the config file
  15. [remote “upstream”]
    url = https://github.com/<path/to/original/project.git&gt;
    fetch = +refs/heads/*:refs/remotes/upstream/*
  16. git push origin master
  17. git push –tags
  18. Verify if the changes are reflecting in your github a/c

These are very basic steps that will help you clone a project , fix something, push the change to your a/c. Then you can send the project owner a pull request so they can review and merge your fix into their project. Hope this will help you take first step towards Git!

Thats all folks!

Advertisements