Skip to content
Browse files

hallaathradisation

  • Loading branch information...
1 parent 23ff87b commit 948f5b42aaaa735ca0350451dff071273e01c2ab @hallaathrad hallaathrad committed with hallaathrad
View
16 Clone-A-Specific-Branch.md
@@ -0,0 +1,16 @@
+#Clone a specific branch
+
+There are many cases where we want to clone a particular branch. For those, we need to run the following command:
+
+````
+// E.g. git clone -b <branch_name> <remote_repo>
+git clone -b wiki bugfixing
+````
+
+
+In the following, please note how a public key setup is required. If you don't have a public key already set, you can also clone by using this:
+
+```
+// Example, with OpenCV 2.4 branch:
+git clone -b 2.4 --single-branch https://github.com/Itseez/opencv.git opencv-2.4
+```
View
11 Clone-a-specific-branch.md
@@ -1,11 +0,0 @@
-<h1>Clone a specific branch</h1>
-
-<p>There are many cases where we want to clone a particular branch. There we need to follow these commands: </p>
- git clone -b <branch_name> <remote_repo>
- <p>Example</p>
- `git clone -b wiki bugfixing`
-<p>This will help to clone specific branch. Please note here public key setup is required. If you don't have public key setup then also you can clone by</p>
-<p>Example, with OpenCV 2.4 branch:</p>
- git clone -b 2.4 --single-branch https://github.com/Itseez/opencv.git opencv-2.4
-
-
View
25 Deleting-A-Branch.md
@@ -0,0 +1,25 @@
+#Delete a Git branch both locally and remotely:
+
+```
+// locally ((if you know what you are doing!)
+git branch -d localBranchName
+
+// and then if you need to...
+// on remote
+git push origin :remoteBranchName
+```
+
+To delete a local branch
+
+git branch -d the_local_branch
+To remove a remote branch (if you know what you are doing!)
+
+git push origin :the_remote_branch
+Note
+
+If you get the error `error: unable to push to unqualified destination: remoteBranchName The destination refspec neither matches an existing ref on the remote nor begins with refs/, and we are unable to guess a prefix based on the source ref. error: failed to push some refs to 'git@repository_name'`
+perhaps someone else has already deleted the branch. Try to synchronize your branch list using
+```
+git fetch -p
+```
+The git manual says -p, --prune After fetching, remove any remote-tracking branches which no longer exist on the remote.
View
3 Deleting-a-branch.md
@@ -1,3 +0,0 @@
-<h1>Delete a Git branch both locally and remotely:<h1>
-
-''' git push origin --delete <branchName>'''
View
22 Git-Pull-Vs-Git-Fetch.md
@@ -0,0 +1,22 @@
+#Git Pull vs Git Fetch:
+
+These two commands are regularly used by git users. Let's see the difference between both commands.
+
+
+For the sake of context, it's worth remembering we're probably working in a clone repo. What's a clone? simply a duplicate of another repository.
+It is basically getting your own copy of someone else's source code.
+
+That said, to keep your clone updated with whatever changes may have been applied to the original, you'll need to bring those to your clone. That's where `fetch` and `pull` come in. `git fetch` is the command that tells your local git to retrieve the latest meta-data info from the original (yet doesn't do any file transfering. It's more like just checking to see if there are any changes available). `git pull` on the other hand does that AND brings (copy) those changes from the remote repository.
+
+E.g.
+```
+git pull origin ankur bugfix
+```
+
+The take away is to keep in mind that there generally are at least three copies of a project on your workstation. One copy is your own repository with your own commit history (the already saved one, so to say). The second copy is your working copy where you are editing and building (not committed yet to your repo). The third copy is your local "cached" copy of a remote repository (probably the original from where you cloned yours).
+You can use `git fetch` to know the changes done in the remote repo/branch since your last pull. This is useful to allow for checking before doing an actual pull, which could change files in your current branch and working copy (and potentially losing your changes, etc).
+
+```
+git fetch
+git diff ...origin
+```
View
18 Git-Pull-vs-Git-Fetch.md
@@ -1,18 +0,0 @@
-<h1>Git Pull vs Git Fetch:</h1>
-
-These two commands are regularly used by git users. Let's see the difference between both commands.
-
-
-A clone is simply a copy of a repository. It is something like where you can download source code from some other repository.
-<b>git fetch</b> is the command that says "bring my local copy of the remote repository up to date."
-<b>git pull</b> says "bring the changes in the remote repository where I keep my own code."
-Normally when use <b>git pull</b> , it does the same thing done by <b>git fetch</b> to bring the local copy of the remote repository(up-to-date), and then merging the changes into own code repo.Example
-
- git pull origin ankur bugfix
-
-
-The take away is to keep in mind that there are often at least three copies of a project on your workstation. One copy is your own repository with your own commit history. The second copy is your working copy where you are editing and building. The third copy is your local "cached" copy of a remote repository.
-One can use git fetch to know the changes done in the remote branch since your last pull since. So you can check before doing an actual pull, which could change files in your current branch and working copy.
-
- git fetch
- git diff ...origin
View
10 Git-shortcut.md → Git-Shortcut.md
@@ -1,10 +1,10 @@
-<h1> Git shortcut</h1>
-<p>A lot of my time is spent in Terminal and a majority of it is spent typing Git commands. I created a set of keyboard shortcuts with Bash aliases and functions to speed up my workflow and save me hundreds of keystrokes every day.</p>
+#Git shortcut
-Git allows you to set aliases but they’re limited and only save you a few keystrokes (i.e. instead of git checkout you can type git co, but you still have to type git). Since Bash is Terminal’s default command-line interpreter, you can also set Bash aliases to reduce your keystrokes even further.
+For most developers, a lot of our time is spent in Terminal and a majority of it is spent typing Git commands.
+We've created a set of keyboard shortcuts with Bash aliases and functions to speed up your workflow and save hundreds of keystrokes every day.
-Here’s my list of Git Bash aliases and functions. To use them as your own, just add them to the file you store your aliases/functions. (i.e. ~/.bash_profile or ~/.bashrc)
+Git allows you to set aliases but they’re limited and only save you a few keystrokes (i.e. instead of git checkout you can type git co, but you still have to type git). Since Bash is Terminal’s default command-line interpreter, you can also set Bash aliases to reduce your keystrokes even further.
-Notes: If you’ve never set an alias before, don’t know where to put them, or have no clue what I’m talking about, read my post on Terminal/Bash Command-Line Shortcuts with Aliases before continuing.
+Here’s a list of Git Bash aliases and functions. To use them as your own, just add them to the file you store your aliases/functions in. (i.e. ~/.bash_profile or ~/.bashrc)
When copy & pasting, it’s important to keep the spacing. (i.e. for aliases, there must be no spaces before and after the equal signs, and for functions, there must be a space after the opening curly bracket of the declaration and a semicolon after the command. Don’t forget to reload your file (source ~/.bash_profile) or restart Terminal after making changes.

0 comments on commit 948f5b4

Please sign in to comment.
Something went wrong with that request. Please try again.