Questions tagged [git-track]

In git, tracking branches are local branches that relate to a remote branch.

Pull/push operations in git have to specify a repository and branch to pull from (or push to). A branch can be made to track a specific branch so that push/pull operations take the tracked branch as the default target.

For example, when cloning a repository, the master branch will track the corresponding branch origin/master. and

When you check out a local branch from a remote branch, a tracking branch is created automatically:

git checkout local_branch1 remote_rep/branch1

If you want to use the same name as the tracked branched you can use

git checkout --track remote_rep/branch1

See also:

27 questions
798
votes
11 answers

How do I remove version tracking from a project cloned from git?

I want to remove all version tracking from a project's directory. What is the correct method to do this? Can I do a shell command such as: rm -rf .git from my projects directory or is there a way to do this as a Git command? I used this project to…
daustin777
  • 10,668
  • 8
  • 23
  • 25
616
votes
10 answers

How do you stop tracking a remote branch in Git?

How do you stop tracking a remote branch in Git? I am asking to stop tracking because in my concrete case, I want to delete the local branch, but not the remote one. Deleting the local one and pushing the deletion to remote will delete the remote…
Jason Cohen
  • 75,915
  • 26
  • 104
  • 111
150
votes
1 answer

git submodule tracking latest

We are moving our (huge) project to git and we are thinking about using submodules. Our plan is to have three different heads in the superproject: release,stable,latest. The project leads will handle the release and stable branches. They will move…
l.thee.a
  • 2,851
  • 5
  • 23
  • 28
30
votes
5 answers

What are tracked files and untracked files in the context of Git?

I'm new to Git. I wish to know what are tracked and untracked files? I read "Pro Git", but still couldn't quite understand. Can someone explain to me the difference between the two by providing an example?
Nayan Soni
  • 911
  • 3
  • 11
  • 20
9
votes
3 answers

How do I create a git branch so that files I add to it are not added to master?

I want to create a git branch that will work independent of the master branch. I want all the code that is present in the master till now, but any further changes in the master should not reflect in the branch and any changes in the branch should…
user811433
  • 3,359
  • 11
  • 48
  • 71
6
votes
2 answers

How to keep track of origin/master in my dev git branch

I am new to git and I would like to know how to tackle a very basic scenario. I read so many posts on stackoverflow about git but still can't figure out the answer. We have an origin/master remote branch that everybody is working on. I have a…
ben39
  • 2,167
  • 2
  • 17
  • 19
6
votes
2 answers

When to use git branch --track (meaning of start "watching upstream")?

Until recently, I have not been aware of --track switch for git branch. I read the documentation and tried this command, but it has no sense to me. --track When creating a new branch, set up branch..remote and branch..merge…
sandalone
  • 38,958
  • 59
  • 205
  • 324
5
votes
1 answer

Accidentally created a branch called --track, and now I can't delete it

So I ran this command: git checkout -b --track origin/RB_1.4.5 I thought that it would create a local branch by the same name and set it up to track the remote branch, but instead it created a branch called --track. I could have sworn that…
solidcell
  • 7,067
  • 3
  • 34
  • 56
4
votes
3 answers

How to delete a git branch named "--track"

I made a mistake when I checked out a new branch with git. git version 1.7.1 I ran git branch -b --track origin/develop and I got a branch named --track. How can I delete it? What I have done: $ git branch --track * develop master $ git branch -d…
BigKuCha
  • 59
  • 4
4
votes
0 answers

Does 'git branch -u (or --set-upstream-to)' lose tracking information of all the existing remote tracking branches?

I was in my 'master' branch when I thought of creating a new branch and did it by: $ git checkout -b od_newstructure Switched to a new branch 'od_newstructure' The I committed few changes and added this new branch to remote and started tracking $…
krips89
  • 1,324
  • 2
  • 14
  • 31
4
votes
1 answer

"git remote show origin": why all branches show "tracked" even when some aren't?

Why does "git remote show origin" list remote branches as "tracked" even when those branches are not linked to a local branch for pull/push? Does "tracked" mean something else in this context? I thought that was the whole meaning of "tracked": git…
Hawkeye Parker
  • 5,502
  • 5
  • 38
  • 43
3
votes
1 answer

Is it possible to stop tracking local changes to a file that you *do* want to be pulled down if changed in the repo?

We have a config file in the repo which all the users contribute to based on their function. For my local testing, I need to manually change two values in that config file, but I never want my changes committed back to the server. I do however want…
Mark A. Donohoe
  • 23,825
  • 17
  • 116
  • 235
2
votes
1 answer

How to check if the branch I'm in is based on a commit of remote tracking branch?

I'm trying to figure out whether I can pull. If my branch is based on a remote branch than he has remote tracking branch, so I can pull. If my branch is based on a commit, it doesn't have a remote tracking branch thus pull would fail. What I managed…
AlikElzin-kilaka
  • 30,165
  • 25
  • 168
  • 248
2
votes
2 answers

Git repo with submodules does not track local changes?

I have a git repository with 3 submodules, like this: foo/ # main repository bar1/ # submodule1 bar2/ # submodule2 bar3/ # submodule3 I've added the submodules directly after executing git init in the main repository: git submodule add…
daniel451
  • 9,128
  • 15
  • 53
  • 115
2
votes
1 answer

Excluding certain files while 'git pull'

I am doing a complex PHP project with two other people. We had git setup for the project from the beginning. After working for two months, we wanted to remove certain folders (/dev/app) from git tracking ( git was already tracking them). So I…
Fawzan
  • 4,181
  • 6
  • 31
  • 73
1
2