Adding new Code to your GitHub Repository
来源:互联网 发布:js array slice 编辑:程序博客网 时间:2024/04/28 14:41
http://annasob.wordpress.com/2009/10/18/adding-new-code-to-your-github-repository/
Previously, I posted a tutorial on setting up GitHub and Git Bash. Now I would like to show you how to get new code into ur repository.
Steps:
- Create a local Branch
- Create a remote Branch
- Add files to your local Branch
- Commit changes to your local Branch
- Push the new branch to GitHub
Those are the steps, now before we get started bookmark this Git cheat sheet its a good reference.
Note: all commands are entered in Git Bash command prompt. How do u open it? On Vista, Start -> Search for Quick->Right click ‘Quick Launch’ result->Select ‘Git Bash Here’
Create a Local Branch
A local branch is a version of your code package saved on your home machine. I believe you can have as many branches as you want.
- git branch <branch name>
Create a Remote Branch
A remote branch is one that sits on the GitHub social coding site, users can select this branch and download code that belongs to this branch alone.
- git push origin origin:refs/heads/branch name>
The command window will give you a confirmation:
——————————————————————
Total 0 (delta 0), reused 0 (delta 0)
To git@github.com:annasob/processing-js.git
* [new branch] origin/HEAD -> withCursor2
——————————————————————
If you get an error saying repository not found make sure your config file is correct. Here is a snippet:
——————————————————————-
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = git@github.com:annasob/processing-js.git
masterremote = origin
merge = refs/heads/master
——————————————————————
Add files to your local branch
I am not sure if this makes a difference, but i just opened the processing-js directory I was working in and dragged any new files/folders I needed to have. Alternatively, you can use these commands, well first you have to tell Git which branch you are going to be working with:
- git checkout <local branch name>
- git add <filename or directory>
Commit changes to your local Branch
Before you can submit the changes to GitHub, you have to commit them on your local machine.
- git commit -a
This command will commit all of your changes and allow you to write a message in vim.Vim guide.
The message should be significant, as everyone will read it to see whats new from the previous versions.
Push the new branch to GitHub
Now you are ready to update the remote branch.
- git push git@github.com:annasob/processing-js.git<remote branch name>
Note: you will need to put your own repository path in. Here is the message you will see:
——————————————————————–
Counting objects: 7, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (5/5), 617 bytes, done.
Total 5 (delta 1), reused 0 (delta 0)
To git@github.com:annasob/processing-js.git
8e069aa..dd33dfd withCursor -> withCursor
———————————————————————-
After you do all of this, log in to ur GitHub account and go to your repository. If you roll over ‘all branches’ you will see your new branch. Select it and try downloading the contents to ensure that nothing is missing.
Note, I have reported a bug, somehow the download functionality in GitHub doesn’t always work.
Hope this tutorial helps :) Feel free to post comments.
- Adding new Code to your GitHub Repository
- adding a new ssh key to your github account
- Adding New Functions to Compiled Code
- Adding New Functions to Compiled Code
- How to avoid relying on github: mirror your repository
- Adding A Middle Tier to Your Java Code Using Jaguar CTS @ JDJ
- Adding new nodes to GI
- Adding a New Parameter (Code Overview)
- Adding a new MAVLink Message (Code Overview)
- ShmooCon IX: Moloch: A New And Free Way To Index Your Packet Capture Repository
- How to create a maven repository for your github project step by step
- Adding Windows To Your Console Application
- Adding Logic Flow Control to Your Programming
- Adding Three20 to your Xcode project
- Adding RF 433MHz to your Arduino
- Adding Object Subscripting Support to Your Classes
- Adding Meaning to your steps轨迹导论
- 14.Adding Frontend Files to your Module
- nyoj 题号12 喷水装置(二)——南阳oj
- ORACLE ASM 转自三思笔记
- matlab 读取文件技巧 经典中的经典
- EasyUI datetimebox时间设置问题
- HAVING 与where
- Adding new Code to your GitHub Repository
- SQL SERVER 数据库所用端口设置
- android平台下lcd调试流程如下
- HttpClient(访问网络) get方式,post方式。返回值有String,InputStream,byte[]
- Android SDK更新失败的解决办法
- Matlab常用函数
- Hadoop实战视频教程下载
- Linux 笔记
- 南京哪家卖投影机原装灯泡?